summaryrefslogtreecommitdiffstats
path: root/drivers/ata
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-07-31 10:38:08 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-09-16 08:32:10 +0200
commited6e965824303255cacc1c1a195d3684caa26bce (patch)
tree26e2b1b78498675ceae4dd2e990836c26ec1d5ec /drivers/ata
parent5bdc82c54a3306f2ae151a00f2df54f9240395b8 (diff)
downloadbarebox-ed6e965824303255cacc1c1a195d3684caa26bce.tar.gz
barebox-ed6e965824303255cacc1c1a195d3684caa26bce.tar.xz
resource: Let dev_request_mem_region return an error pointer
For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/ahci.c3
-rw-r--r--drivers/ata/intf_platform_ide.c9
-rw-r--r--drivers/ata/pata-imx.c2
-rw-r--r--drivers/ata/sata-imx.c4
4 files changed, 13 insertions, 5 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 810d9abef7..645e9b5b7e 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -28,6 +28,7 @@
#include <malloc.h>
#include <scsi.h>
#include <linux/ctype.h>
+#include <linux/err.h>
#include <disks.h>
#include <asm/mmu.h>
#include <ata_drive.h>
@@ -654,6 +655,8 @@ static int ahci_probe(struct device_d *dev)
ahci = xzalloc(sizeof(*ahci));
regs = dev_request_mem_region(dev, 0);
+ if (IS_ERR(regs))
+ return PTR_ERR(regs);
ahci->dev = dev;
ahci->mmio_base = regs;
diff --git a/drivers/ata/intf_platform_ide.c b/drivers/ata/intf_platform_ide.c
index 851f8f5c5b..0d392d8d4a 100644
--- a/drivers/ata/intf_platform_ide.c
+++ b/drivers/ata/intf_platform_ide.c
@@ -84,7 +84,7 @@ static int platform_ide_probe(struct device_d *dev)
struct ide_port *ide;
void *reg_base, *alt_base = NULL;
struct resource *reg, *alt;
- int mmio;
+ int mmio = 0;
if (pdata == NULL) {
dev_err(dev, "No platform data. Cannot continue\n");
@@ -92,9 +92,12 @@ static int platform_ide_probe(struct device_d *dev)
}
reg_base = dev_request_mem_region(dev, 0);
- mmio = (reg_base != NULL);
- if (mmio) {
+
+ if (!IS_ERR(reg_base)) {
+ mmio = 1;
alt_base = dev_request_mem_region(dev, 1);
+ if (IS_ERR(alt_base))
+ alt_base = NULL;
} else {
reg = dev_get_resource(dev, IORESOURCE_IO, 0);
if (IS_ERR(reg))
diff --git a/drivers/ata/pata-imx.c b/drivers/ata/pata-imx.c
index 6bd7524a6a..d8deba1461 100644
--- a/drivers/ata/pata-imx.c
+++ b/drivers/ata/pata-imx.c
@@ -161,6 +161,8 @@ static int imx_pata_probe(struct device_d *dev)
ide = xzalloc(sizeof(*ide));
base = dev_request_mem_region(dev, 0);
+ if (IS_ERR(base))
+ return PTR_ERR(base);
clk = clk_get(dev, NULL);
if (IS_ERR(clk)) {
diff --git a/drivers/ata/sata-imx.c b/drivers/ata/sata-imx.c
index 450cf4f53f..1c0e1dbd7d 100644
--- a/drivers/ata/sata-imx.c
+++ b/drivers/ata/sata-imx.c
@@ -99,8 +99,8 @@ static int imx_sata_probe(struct device_d *dev)
}
imx_ahci->ahci.mmio_base = dev_request_mem_region(dev, 0);
- if (!imx_ahci->ahci.mmio_base)
- return -ENODEV;
+ if (IS_ERR(imx_ahci->ahci.mmio_base))
+ return PTR_ERR(imx_ahci->ahci.mmio_base);
data->init(imx_ahci);