[PATCH 05/18] i2c-at91: Use IS_ERR instead of checking for NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dev_request_mem_region doesn't return NULL to indicate error and IS_ERR
should be used in conjuction with it in order to detect failure.

Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
---
 drivers/i2c/busses/i2c-at91.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c
index 622c56d..6db7243 100644
--- a/drivers/i2c/busses/i2c-at91.c
+++ b/drivers/i2c/busses/i2c-at91.c
@@ -426,9 +426,9 @@ static int at91_twi_probe(struct device_d *dev)
 	i2c_at91->pdata = i2c_data;
 
 	i2c_at91->base = dev_request_mem_region(dev, 0);
-	if (!i2c_at91->base) {
+	if (IS_ERR(i2c_at91->base)) {
 		dev_err(dev, "could not get memory region\n");
-		rc = -ENODEV;
+		rc = PTR_ERR(i2c_at91->base);
 		goto out_free;
 	}
 
-- 
2.5.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux