[PATCH 05/18] i2c-at91: Use IS_ERR instead of checking for NULL
Andrey Smirnov
andrew.smirnov at gmail.com
Tue Feb 16 17:29:06 PST 2016
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 at gmail.com>
---
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
More information about the barebox
mailing list