Skip to contentSkip to conversation

drivers/i2c/busses/i2c-nvidia-gpu.c:284:1-3: WARNING: PTR_ERR_OR_ZERO can be used

PATCH kbuild test robot 1 participant 2 messages Oct 9, 2019

Subsystems (2)
lore
Share & tools
lore

kbuild test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/i2c/new_dummy
head:   b401cd1e73e824b8e1231b97c36b7fa21017b669
commit: b401cd1e73e824b8e1231b97c36b7fa21017b669 [5/5] plain

If you fix the issue, kindly add following tag

coccinelle warnings: (new ones prefixed by >>)

>> drivers/i2c/busses/i2c-nvidia-gpu.c:284:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

author build bot
#1 lore raw

[PATCH] fix ptr_ret.cocci warnings

drivers/i2c/busses/i2c-nvidia-gpu.c:284:1-3: WARNING: PTR_ERR_OR_ZERO can be used

From: kbuild test robot <[email protected]>

drivers/i2c/busses/i2c-nvidia-gpu.c:284: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 b401cd1e73e8 ("plain")

---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/i2c/new_dummy
head:   b401cd1e73e824b8e1231b97c36b7fa21017b669
commit: b401cd1e73e824b8e1231b97c36b7fa21017b669 [5/5] plain
 i2c-nvidia-gpu.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/i2c/busses/i2c-nvidia-gpu.c +1 -4
@@ -281,10 +281,7 @@ static int gpu_populate_client(struct gp
 	i2cd->gpu_ccgx_ucsi->irq = irq;
 	i2cd->gpu_ccgx_ucsi->properties = ccgx_props;
 	i2cd->ccgx_client = i2c_new_client_device(&i2cd->adapter, i2cd->gpu_ccgx_ucsi);
-	if (IS_ERR(i2cd->ccgx_client))
-		return PTR_ERR(i2cd->ccgx_client);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(i2cd->ccgx_client);
 }
 
 static int gpu_i2c_probe(struct pci_dev *pdev, const struct pci_device_id *id)