diff mbox series

irqchip/aspeed-i2c-ic: Fix return value check in aspeed_i2c_ic_of_init()

Message ID 1507719023-127618-1-git-send-email-weiyongjun1@huawei.com
State Awaiting Upstream
Headers show
Series irqchip/aspeed-i2c-ic: Fix return value check in aspeed_i2c_ic_of_init() | expand

Commit Message

Wei Yongjun Oct. 11, 2017, 10:50 a.m. UTC
In case of error, the function of_iomap() returns NULL pointer not
ERR_PTR(). The IS_ERR() test in the return value check should be
replaced with NULL test..

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/irqchip/irq-aspeed-i2c-ic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Brendan Higgins Oct. 19, 2017, 1:01 a.m. UTC | #1
On Wed, Oct 11, 2017 at 3:50 AM, Wei Yongjun <weiyongjun1@huawei.com> wrote:
> In case of error, the function of_iomap() returns NULL pointer not
> ERR_PTR(). The IS_ERR() test in the return value check should be
> replaced with NULL test..
>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> ---
>  drivers/irqchip/irq-aspeed-i2c-ic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/irqchip/irq-aspeed-i2c-ic.c b/drivers/irqchip/irq-aspeed-i2c-ic.c
> index 815b88d..f20200a 100644
> --- a/drivers/irqchip/irq-aspeed-i2c-ic.c
> +++ b/drivers/irqchip/irq-aspeed-i2c-ic.c
> @@ -76,8 +76,8 @@ static int __init aspeed_i2c_ic_of_init(struct device_node *node,
>                 return -ENOMEM;
>
>         i2c_ic->base = of_iomap(node, 0);
> -       if (IS_ERR(i2c_ic->base)) {
> -               ret = PTR_ERR(i2c_ic->base);
> +       if (!i2c_ic->base) {
> +               ret = -ENOMEM;
>                 goto err_free_ic;
>         }
>
>
>
>
Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-aspeed-i2c-ic.c b/drivers/irqchip/irq-aspeed-i2c-ic.c
index 815b88d..f20200a 100644
--- a/drivers/irqchip/irq-aspeed-i2c-ic.c
+++ b/drivers/irqchip/irq-aspeed-i2c-ic.c
@@ -76,8 +76,8 @@  static int __init aspeed_i2c_ic_of_init(struct device_node *node,
 		return -ENOMEM;
 
 	i2c_ic->base = of_iomap(node, 0);
-	if (IS_ERR(i2c_ic->base)) {
-		ret = PTR_ERR(i2c_ic->base);
+	if (!i2c_ic->base) {
+		ret = -ENOMEM;
 		goto err_free_ic;
 	}