[PATCH] w1: fix ptr_ret.cocci warnings

From: kbuild test robot
Date: Fri Aug 30 2019 - 07:44:17 EST


From: kbuild test robot <lkp@xxxxxxxxx>

drivers/w1/slaves/w1_ds250x.c:215:1-3: WARNING: PTR_ERR_OR_ZERO can be used


Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR

Generated by: scripts/coccinelle/api/ptr_ret.cocci

Fixes: d835b3166dd6 ("w1: add DS2501, DS2502, DS2505 EPROM device driver")
CC: Thomas Bogendoerfer <tbogendoerfer@xxxxxxx>
Signed-off-by: kbuild test robot <lkp@xxxxxxxxx>
---

url: https://github.com/0day-ci/linux/commits/Thomas-Bogendoerfer/w1-add-1-wire-master-driver-for-IP-block-found-in-SGI-ASICs/20190830-122322

w1_ds250x.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/w1/slaves/w1_ds250x.c
+++ b/drivers/w1/slaves/w1_ds250x.c
@@ -212,10 +212,7 @@ static int w1_eprom_add_slave(struct w1_
nvmem_cfg.size = data->size;

nvmem = devm_nvmem_register(&sl->dev, &nvmem_cfg);
- if (IS_ERR(nvmem))
- return PTR_ERR(nvmem);
-
- return 0;
+ return PTR_ERR_OR_ZERO(nvmem);
}

static struct w1_family_ops w1_eprom_fops = {