linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] adjust inconsistent IS_ERR and PTR_ERR
@ 2012-08-25 19:57 Julia Lawall
  2012-08-25 19:57 ` [PATCH 1/6] fs/nfsd/nfs4idmap.c: " Julia Lawall
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Julia Lawall @ 2012-08-25 19:57 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

These patches fix cases where PTR_ERR does not access the value just tested
by IS_ERR.


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

* [PATCH 1/6] fs/nfsd/nfs4idmap.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 [PATCH 0/6] adjust inconsistent IS_ERR and PTR_ERR Julia Lawall
@ 2012-08-25 19:57 ` Julia Lawall
  2012-08-28  1:44   ` J. Bruce Fields
  2012-08-25 19:57 ` [PATCH 2/6] drivers/media/platform/mx2_emmaprp.c: " Julia Lawall
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Julia Lawall @ 2012-08-25 19:57 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: kernel-janitors, linux-nfs, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Change the call to PTR_ERR to access the value just tested by IS_ERR.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
@@

(
if (IS_ERR(e)) { ... PTR_ERR(e) ... }
|
if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... }
|
*if (IS_ERR(e))
 { ...
*  PTR_ERR(e1)
   ... }
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 fs/nfsd/nfs4idmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index fdc91a6..11df4ac 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -478,7 +478,7 @@ nfsd_idmap_init(struct net *net)
 		goto destroy_idtoname_cache;
 	nn->nametoid_cache = cache_create_net(&nametoid_cache_template, net);
 	if (IS_ERR(nn->nametoid_cache)) {
-		rv = PTR_ERR(nn->idtoname_cache);
+		rv = PTR_ERR(nn->nametoid_cache);
 		goto unregister_idtoname_cache;
 	}
 	rv = cache_register_net(nn->nametoid_cache, net);


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

* [PATCH 2/6] drivers/media/platform/mx2_emmaprp.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 [PATCH 0/6] adjust inconsistent IS_ERR and PTR_ERR Julia Lawall
  2012-08-25 19:57 ` [PATCH 1/6] fs/nfsd/nfs4idmap.c: " Julia Lawall
@ 2012-08-25 19:57 ` Julia Lawall
  2012-08-25 19:57 ` [PATCH 3/6] drivers/usb/gadget/lpc32xx_udc.c: " Julia Lawall
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2012-08-25 19:57 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: kernel-janitors, linux-media, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Change the call to IS_ERR to test the value that was just initialized and
is returned using PTR_ERR.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
@@

(
if (IS_ERR(e)) { ... PTR_ERR(e) ... }
|
if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... }
|
*if (IS_ERR(e))
 { ...
*  PTR_ERR(e1)
   ... }
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/media/platform/mx2_emmaprp.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/media/platform/mx2_emmaprp.c b/drivers/media/platform/mx2_emmaprp.c
index dab380a..2be1bb1 100644
--- a/drivers/media/platform/mx2_emmaprp.c
+++ b/drivers/media/platform/mx2_emmaprp.c
@@ -908,9 +908,8 @@ static int emmaprp_probe(struct platform_device *pdev)
 	}
 
 	pcdev->clk_emma_ahb = devm_clk_get(&pdev->dev, "ahb");
-	if (IS_ERR(pcdev->clk_emma_ipg)) {
+	if (IS_ERR(pcdev->clk_emma_ahb))
 		return PTR_ERR(pcdev->clk_emma_ahb);
-	}
 
 	irq_emma = platform_get_irq(pdev, 0);
 	res_emma = platform_get_resource(pdev, IORESOURCE_MEM, 0);


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

* [PATCH 3/6] drivers/usb/gadget/lpc32xx_udc.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 [PATCH 0/6] adjust inconsistent IS_ERR and PTR_ERR Julia Lawall
  2012-08-25 19:57 ` [PATCH 1/6] fs/nfsd/nfs4idmap.c: " Julia Lawall
  2012-08-25 19:57 ` [PATCH 2/6] drivers/media/platform/mx2_emmaprp.c: " Julia Lawall
@ 2012-08-25 19:57 ` Julia Lawall
  2012-08-25 19:57 ` [PATCH 4/6] drivers/usb/host/ohci-nxp.c: " Julia Lawall
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2012-08-25 19:57 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: kernel-janitors, Greg Kroah-Hartman, linux-usb, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Change the call to PTR_ERR to access the value just tested by IS_ERR.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
@@

(
if (IS_ERR(e)) { ... PTR_ERR(e) ... }
|
if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... }
|
*if (IS_ERR(e))
 { ...
*  PTR_ERR(e1)
   ... }
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/usb/gadget/lpc32xx_udc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/lpc32xx_udc.c b/drivers/usb/gadget/lpc32xx_udc.c
index f1ec99e..3a6cdd0 100644
--- a/drivers/usb/gadget/lpc32xx_udc.c
+++ b/drivers/usb/gadget/lpc32xx_udc.c
@@ -3208,7 +3208,7 @@ static int __init lpc32xx_udc_probe(struct platform_device *pdev)
 	udc->usb_otg_clk = clk_get(&pdev->dev, "ck_usb_otg");
 	if (IS_ERR(udc->usb_otg_clk)) {
 		dev_err(udc->dev, "failed to acquire USB otg clock\n");
-		retval = PTR_ERR(udc->usb_slv_clk);
+		retval = PTR_ERR(udc->usb_otg_clk);
 		goto usb_otg_clk_get_fail;
 	}
 


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

* [PATCH 4/6] drivers/usb/host/ohci-nxp.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 [PATCH 0/6] adjust inconsistent IS_ERR and PTR_ERR Julia Lawall
                   ` (2 preceding siblings ...)
  2012-08-25 19:57 ` [PATCH 3/6] drivers/usb/gadget/lpc32xx_udc.c: " Julia Lawall
@ 2012-08-25 19:57 ` Julia Lawall
  2012-08-27 14:38   ` Alan Stern
  2012-08-25 19:57 ` [PATCH 5/6] drivers/staging/crystalhd/crystalhd_lnx.c: " Julia Lawall
  2012-08-25 19:57 ` [PATCH 6/6] drivers/iio/adc/at91_adc.c: " Julia Lawall
  5 siblings, 1 reply; 10+ messages in thread
From: Julia Lawall @ 2012-08-25 19:57 UTC (permalink / raw)
  To: Alan Stern; +Cc: kernel-janitors, Greg Kroah-Hartman, linux-usb, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Change the call to PTR_ERR to access the value just tested by IS_ERR.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
@@

(
if (IS_ERR(e)) { ... PTR_ERR(e) ... }
|
if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... }
|
*if (IS_ERR(e))
 { ...
*  PTR_ERR(e1)
   ... }
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/usb/host/ohci-nxp.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
index a446386..c60066a 100644
--- a/drivers/usb/host/ohci-nxp.c
+++ b/drivers/usb/host/ohci-nxp.c
@@ -355,7 +355,7 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
 	usb_otg_clk = clk_get(&pdev->dev, "ck_usb_otg");
 	if (IS_ERR(usb_otg_clk)) {
 		dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
-		ret = PTR_ERR(usb_dev_clk);
+		ret = PTR_ERR(usb_otg_clk);
 		goto out6;
 	}
 


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

* [PATCH 5/6] drivers/staging/crystalhd/crystalhd_lnx.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 [PATCH 0/6] adjust inconsistent IS_ERR and PTR_ERR Julia Lawall
                   ` (3 preceding siblings ...)
  2012-08-25 19:57 ` [PATCH 4/6] drivers/usb/host/ohci-nxp.c: " Julia Lawall
@ 2012-08-25 19:57 ` Julia Lawall
  2012-08-25 19:57 ` [PATCH 6/6] drivers/iio/adc/at91_adc.c: " Julia Lawall
  5 siblings, 0 replies; 10+ messages in thread
From: Julia Lawall @ 2012-08-25 19:57 UTC (permalink / raw)
  To: Naren Sankar
  Cc: kernel-janitors, Jarod Wilson, Scott Davilla, Manu Abraham,
	Greg Kroah-Hartman, devel, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Change the call to PTR_ERR to access the value just tested by IS_ERR.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
@@

(
if (IS_ERR(e)) { ... PTR_ERR(e) ... }
|
if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... }
|
*if (IS_ERR(e))
 { ...
*  PTR_ERR(e1)
   ... }
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/staging/crystalhd/crystalhd_lnx.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/crystalhd/crystalhd_lnx.c b/drivers/staging/crystalhd/crystalhd_lnx.c
index 5909d8d..166203a 100644
--- a/drivers/staging/crystalhd/crystalhd_lnx.c
+++ b/drivers/staging/crystalhd/crystalhd_lnx.c
@@ -381,7 +381,7 @@ static int __devinit chd_dec_init_chdev(struct crystalhd_adp *adp)
 	dev = device_create(crystalhd_class, NULL, MKDEV(adp->chd_dec_major, 0),
 			    NULL, "crystalhd");
 	if (IS_ERR(dev)) {
-		rc = PTR_ERR(crystalhd_class);
+		rc = PTR_ERR(dev);
 		BCMLOG_ERR("failed to create device\n");
 		goto device_create_fail;
 	}


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

* [PATCH 6/6] drivers/iio/adc/at91_adc.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 [PATCH 0/6] adjust inconsistent IS_ERR and PTR_ERR Julia Lawall
                   ` (4 preceding siblings ...)
  2012-08-25 19:57 ` [PATCH 5/6] drivers/staging/crystalhd/crystalhd_lnx.c: " Julia Lawall
@ 2012-08-25 19:57 ` Julia Lawall
  2012-08-27 20:16   ` Jonathan Cameron
  5 siblings, 1 reply; 10+ messages in thread
From: Julia Lawall @ 2012-08-25 19:57 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: kernel-janitors, linux-iio, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

Change the call to PTR_ERR to access the value just tested by IS_ERR.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e,e1;
@@

(
if (IS_ERR(e)) { ... PTR_ERR(e) ... }
|
if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... }
|
*if (IS_ERR(e))
 { ...
*  PTR_ERR(e1)
   ... }
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/iio/adc/at91_adc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 98c96f9..8650281 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -604,7 +604,7 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
 	st->adc_clk = devm_clk_get(&pdev->dev, "adc_op_clk");
 	if (IS_ERR(st->adc_clk)) {
 		dev_err(&pdev->dev, "Failed to get the ADC clock.\n");
-		ret = PTR_ERR(st->clk);
+		ret = PTR_ERR(st->adc_clk);
 		goto error_disable_clk;
 	}
 


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

* Re: [PATCH 4/6] drivers/usb/host/ohci-nxp.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 ` [PATCH 4/6] drivers/usb/host/ohci-nxp.c: " Julia Lawall
@ 2012-08-27 14:38   ` Alan Stern
  0 siblings, 0 replies; 10+ messages in thread
From: Alan Stern @ 2012-08-27 14:38 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, Greg Kroah-Hartman, linux-usb, linux-kernel

On Sat, 25 Aug 2012, Julia Lawall wrote:

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Change the call to PTR_ERR to access the value just tested by IS_ERR.

> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  drivers/usb/host/ohci-nxp.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c
> index a446386..c60066a 100644
> --- a/drivers/usb/host/ohci-nxp.c
> +++ b/drivers/usb/host/ohci-nxp.c
> @@ -355,7 +355,7 @@ static int __devinit usb_hcd_nxp_probe(struct platform_device *pdev)
>  	usb_otg_clk = clk_get(&pdev->dev, "ck_usb_otg");
>  	if (IS_ERR(usb_otg_clk)) {
>  		dev_err(&pdev->dev, "failed to acquire USB DEV Clock\n");
> -		ret = PTR_ERR(usb_dev_clk);
> +		ret = PTR_ERR(usb_otg_clk);
>  		goto out6;
>  	}

Acked-by: Alan Stern <stern@rowland.harvard.edu>


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

* Re: [PATCH 6/6] drivers/iio/adc/at91_adc.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 ` [PATCH 6/6] drivers/iio/adc/at91_adc.c: " Julia Lawall
@ 2012-08-27 20:16   ` Jonathan Cameron
  0 siblings, 0 replies; 10+ messages in thread
From: Jonathan Cameron @ 2012-08-27 20:16 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Jonathan Cameron, kernel-janitors, linux-iio, linux-kernel

On 08/25/2012 08:57 PM, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Change the call to PTR_ERR to access the value just tested by IS_ERR.
> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e,e1;
> @@
> 
> (
> if (IS_ERR(e)) { ... PTR_ERR(e) ... }
> |
> if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... }
> |
> *if (IS_ERR(e))
>  { ...
> *  PTR_ERR(e1)
>    ... }
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Thanks Julia and keep up the good work!

I've merge this one with a bit of fuzz to
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git

fixes-togreg
> 
> ---
>  drivers/iio/adc/at91_adc.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
> index 98c96f9..8650281 100644
> --- a/drivers/iio/adc/at91_adc.c
> +++ b/drivers/iio/adc/at91_adc.c
> @@ -604,7 +604,7 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
>  	st->adc_clk = devm_clk_get(&pdev->dev, "adc_op_clk");
>  	if (IS_ERR(st->adc_clk)) {
>  		dev_err(&pdev->dev, "Failed to get the ADC clock.\n");
> -		ret = PTR_ERR(st->clk);
> +		ret = PTR_ERR(st->adc_clk);
>  		goto error_disable_clk;
>  	}
>  
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 1/6] fs/nfsd/nfs4idmap.c: adjust inconsistent IS_ERR and PTR_ERR
  2012-08-25 19:57 ` [PATCH 1/6] fs/nfsd/nfs4idmap.c: " Julia Lawall
@ 2012-08-28  1:44   ` J. Bruce Fields
  0 siblings, 0 replies; 10+ messages in thread
From: J. Bruce Fields @ 2012-08-28  1:44 UTC (permalink / raw)
  To: Julia Lawall; +Cc: kernel-janitors, linux-nfs, linux-kernel

On Sat, Aug 25, 2012 at 09:57:04PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Change the call to PTR_ERR to access the value just tested by IS_ERR.

Applying for 3.7, thanks.--b.

> 
> The semantic match that finds this problem is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e,e1;
> @@
> 
> (
> if (IS_ERR(e)) { ... PTR_ERR(e) ... }
> |
> if (IS_ERR(e=e1)) { ... PTR_ERR(e) ... }
> |
> *if (IS_ERR(e))
>  { ...
> *  PTR_ERR(e1)
>    ... }
> )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
>  fs/nfsd/nfs4idmap.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
> index fdc91a6..11df4ac 100644
> --- a/fs/nfsd/nfs4idmap.c
> +++ b/fs/nfsd/nfs4idmap.c
> @@ -478,7 +478,7 @@ nfsd_idmap_init(struct net *net)
>  		goto destroy_idtoname_cache;
>  	nn->nametoid_cache = cache_create_net(&nametoid_cache_template, net);
>  	if (IS_ERR(nn->nametoid_cache)) {
> -		rv = PTR_ERR(nn->idtoname_cache);
> +		rv = PTR_ERR(nn->nametoid_cache);
>  		goto unregister_idtoname_cache;
>  	}
>  	rv = cache_register_net(nn->nametoid_cache, net);
> 

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

end of thread, other threads:[~2012-08-28  1:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-25 19:57 [PATCH 0/6] adjust inconsistent IS_ERR and PTR_ERR Julia Lawall
2012-08-25 19:57 ` [PATCH 1/6] fs/nfsd/nfs4idmap.c: " Julia Lawall
2012-08-28  1:44   ` J. Bruce Fields
2012-08-25 19:57 ` [PATCH 2/6] drivers/media/platform/mx2_emmaprp.c: " Julia Lawall
2012-08-25 19:57 ` [PATCH 3/6] drivers/usb/gadget/lpc32xx_udc.c: " Julia Lawall
2012-08-25 19:57 ` [PATCH 4/6] drivers/usb/host/ohci-nxp.c: " Julia Lawall
2012-08-27 14:38   ` Alan Stern
2012-08-25 19:57 ` [PATCH 5/6] drivers/staging/crystalhd/crystalhd_lnx.c: " Julia Lawall
2012-08-25 19:57 ` [PATCH 6/6] drivers/iio/adc/at91_adc.c: " Julia Lawall
2012-08-27 20:16   ` Jonathan Cameron

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).