linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code
@ 2020-05-06  9:01 Samuel Zou
  2020-05-27 10:09 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Samuel Zou @ 2020-05-06  9:01 UTC (permalink / raw)
  To: ajayg; +Cc: linux-i2c, linux-kernel, Samuel Zou

Fixes coccicheck warning:

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

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Samuel Zou <zou_wei@huawei.com>
---
 drivers/i2c/busses/i2c-nvidia-gpu.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
index f5d25ce..dba5d11 100644
--- a/drivers/i2c/busses/i2c-nvidia-gpu.c
+++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
@@ -277,10 +277,8 @@ static int gpu_populate_client(struct gpu_i2c_dev *i2cd, int irq)
 	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)
-- 
2.6.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code
  2020-05-06  9:01 [PATCH -next] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code Samuel Zou
@ 2020-05-27 10:09 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2020-05-27 10:09 UTC (permalink / raw)
  To: Samuel Zou; +Cc: ajayg, linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 429 bytes --]

On Wed, May 06, 2020 at 05:01:10PM +0800, Samuel Zou wrote:
> Fixes coccicheck warning:
> 
> drivers/i2c/busses/i2c-nvidia-gpu.c:280:1-3: WARNING: PTR_ERR_OR_ZERO can be used
> 
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Samuel Zou <zou_wei@huawei.com>

Thanks, but has been fixed already with

http://patchwork.ozlabs.org/project/linux-i2c/patch/20200505145230.17251-1-aishwaryarj100@gmail.com/


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-27 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-06  9:01 [PATCH -next] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code Samuel Zou
2020-05-27 10:09 ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).