All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code
@ 2020-05-05 14:52 Aishwarya Ramakrishnan
  2020-05-22 15:17 ` Wolfram Sang
  2020-05-27 10:08 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Aishwarya Ramakrishnan @ 2020-05-05 14:52 UTC (permalink / raw)
  To: Ajay Gupta, linux-i2c, linux-kernel; +Cc: aishwaryarj100

PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR.

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

Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
---
 drivers/i2c/busses/i2c-nvidia-gpu.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
index f5d25ce00f03..f480105000b8 100644
--- a/drivers/i2c/busses/i2c-nvidia-gpu.c
+++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
@@ -277,10 +277,7 @@ 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.17.1


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

* Re: [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code
  2020-05-05 14:52 [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code Aishwarya Ramakrishnan
@ 2020-05-22 15:17 ` Wolfram Sang
  2020-05-26 16:08   ` Ajay Gupta
  2020-05-27 10:08 ` Wolfram Sang
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2020-05-22 15:17 UTC (permalink / raw)
  To: Aishwarya Ramakrishnan; +Cc: Ajay Gupta, linux-i2c, linux-kernel

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

On Tue, May 05, 2020 at 08:22:30PM +0530, Aishwarya Ramakrishnan wrote:
> PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR.
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>

Waiting for the Rev-by from Ajay (driver maintainer).

> ---
>  drivers/i2c/busses/i2c-nvidia-gpu.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-nvidia-gpu.c
> index f5d25ce00f03..f480105000b8 100644
> --- a/drivers/i2c/busses/i2c-nvidia-gpu.c
> +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
> @@ -277,10 +277,7 @@ 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.17.1
> 

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

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

* RE: [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code
  2020-05-22 15:17 ` Wolfram Sang
@ 2020-05-26 16:08   ` Ajay Gupta
  0 siblings, 0 replies; 4+ messages in thread
From: Ajay Gupta @ 2020-05-26 16:08 UTC (permalink / raw)
  To: Wolfram Sang, Aishwarya Ramakrishnan; +Cc: linux-i2c, linux-kernel

Hi Wolfram,

> -----Original Message-----
> From: linux-i2c-owner@vger.kernel.org <linux-i2c-owner@vger.kernel.org> On
> Behalf Of Wolfram Sang
> Sent: Friday, May 22, 2020 8:17 AM
> To: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
> Cc: Ajay Gupta <ajayg@nvidia.com>; linux-i2c@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify
> code
> 
> On Tue, May 05, 2020 at 08:22:30PM +0530, Aishwarya Ramakrishnan wrote:
> > PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR.
> >
> > Generated by: scripts/coccinelle/api/ptr_ret.cocci
> >
> > Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>
> 
> Waiting for the Rev-by from Ajay (driver maintainer).
Reviewed-by: Ajay Gupta <ajayg@nvidia.com>

Thanks
Ajay
>nvpublic
> 
> > ---
> >  drivers/i2c/busses/i2c-nvidia-gpu.c | 5 +----
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-nvidia-gpu.c b/drivers/i2c/busses/i2c-
> nvidia-gpu.c
> > index f5d25ce00f03..f480105000b8 100644
> > --- a/drivers/i2c/busses/i2c-nvidia-gpu.c
> > +++ b/drivers/i2c/busses/i2c-nvidia-gpu.c
> > @@ -277,10 +277,7 @@ 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.17.1
> >

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

* Re: [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code
  2020-05-05 14:52 [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code Aishwarya Ramakrishnan
  2020-05-22 15:17 ` Wolfram Sang
@ 2020-05-27 10:08 ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2020-05-27 10:08 UTC (permalink / raw)
  To: Aishwarya Ramakrishnan; +Cc: Ajay Gupta, linux-i2c, linux-kernel

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

On Tue, May 05, 2020 at 08:22:30PM +0530, Aishwarya Ramakrishnan wrote:
> PTR_ERR_OR_ZERO contains if(IS_ERR(...)) + PTR_ERR.
> 
> Generated by: scripts/coccinelle/api/ptr_ret.cocci
> 
> Signed-off-by: Aishwarya Ramakrishnan <aishwaryarj100@gmail.com>

Applied to for-next, thanks!


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

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

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

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-05 14:52 [PATCH] i2c: nvidia-gpu: Use PTR_ERR_OR_ZERO() to simplify code Aishwarya Ramakrishnan
2020-05-22 15:17 ` Wolfram Sang
2020-05-26 16:08   ` Ajay Gupta
2020-05-27 10:08 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.