Prefer using IS_ERR_OR_NULL() over using IS_ERR() and a manual NULL
check.

Change generated with coccinelle.

To: Miquel Raynal <[email protected]>
To: Richard Weinberger <[email protected]>
To: Vignesh Raghavendra <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Philipp Hahn <[email protected]>
---
 drivers/mtd/nand/raw/gpio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/raw/gpio.c b/drivers/mtd/nand/raw/gpio.c
index 
69e5e43532a448aa6273f3df79f53145784ccc05..86a8b62fb9e8510d36f925b8b468ec17c77e26d8
 100644
--- a/drivers/mtd/nand/raw/gpio.c
+++ b/drivers/mtd/nand/raw/gpio.c
@@ -276,9 +276,9 @@ static void gpio_nand_remove(struct platform_device *pdev)
        nand_cleanup(chip);
 
        /* Enable write protection and disable the chip */
-       if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp))
+       if (!IS_ERR_OR_NULL(gpiomtd->nwp))
                gpiod_set_value(gpiomtd->nwp, 0);
-       if (gpiomtd->nce && !IS_ERR(gpiomtd->nce))
+       if (!IS_ERR_OR_NULL(gpiomtd->nce))
                gpiod_set_value(gpiomtd->nce, 0);
 }
 
@@ -358,7 +358,7 @@ static int gpio_nand_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, gpiomtd);
 
        /* Disable write protection, if wired up */
-       if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp))
+       if (!IS_ERR_OR_NULL(gpiomtd->nwp))
                gpiod_direction_output(gpiomtd->nwp, 1);
 
        /*
@@ -381,10 +381,10 @@ static int gpio_nand_probe(struct platform_device *pdev)
                return 0;
 
 err_wp:
-       if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp))
+       if (!IS_ERR_OR_NULL(gpiomtd->nwp))
                gpiod_set_value(gpiomtd->nwp, 0);
 out_ce:
-       if (gpiomtd->nce && !IS_ERR(gpiomtd->nce))
+       if (!IS_ERR_OR_NULL(gpiomtd->nce))
                gpiod_set_value(gpiomtd->nce, 0);
 
        return ret;

-- 
2.43.0


Reply via email to