diff mbox

ASoC: atmel-classd: fix odd_ptr_err.cocci warnings

Message ID 20150928091029.GA23312@roam (mailing list archive)
State New, archived
Headers show

Commit Message

kernel test robot Sept. 28, 2015, 9:10 a.m. UTC
sound/soc/atmel/atmel-classd.c:578:5-11: inconsistent IS_ERR and PTR_ERR, PTR_ERR on line 579

 PTR_ERR should access the value just tested by IS_ERR

Semantic patch information:
 There can be false positives in the patch case, where it is the call
 IS_ERR that is wrong.

Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

CC: Songjun Wu <songjun.wu@atmel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 atmel-classd.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Korsgaard Sept. 28, 2015, 11:26 a.m. UTC | #1
>>>>> "kbuild" == kbuild test robot <lkp@intel.com> writes:

 > sound/soc/atmel/atmel-classd.c:578:5-11: inconsistent IS_ERR and PTR_ERR, PTR_ERR on line 579
 >  PTR_ERR should access the value just tested by IS_ERR

 > Semantic patch information:
 >  There can be false positives in the patch case, where it is the call
 >  IS_ERR that is wrong.

 > Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci

 > CC: Songjun Wu <songjun.wu@atmel.com>
 > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
 > ---

 >  atmel-classd.c |    2 +-
 >  1 file changed, 1 insertion(+), 1 deletion(-)

 > --- a/sound/soc/atmel/atmel-classd.c
 > +++ b/sound/soc/atmel/atmel-classd.c
 > @@ -576,7 +576,7 @@ static int atmel_classd_probe(struct pla
 
 dd-> gclk = devm_clk_get(dev, "gclk");
 >  	if (IS_ERR(dd->aclk)) {
 > -		ret = PTR_ERR(dd->gclk);
 > +		ret = PTR_ERR(dd->aclk);

It looks like it is the other way around. It should test
IS_ERR(dd->gclk) instead.
Songjun Wu Sept. 29, 2015, 1:42 a.m. UTC | #2
On 9/28/2015 19:26, Peter Korsgaard wrote:
>>>>>> "kbuild" == kbuild test robot <lkp@intel.com> writes:
>
>   > sound/soc/atmel/atmel-classd.c:578:5-11: inconsistent IS_ERR and PTR_ERR, PTR_ERR on line 579
>   >  PTR_ERR should access the value just tested by IS_ERR
>
>   > Semantic patch information:
>   >  There can be false positives in the patch case, where it is the call
>   >  IS_ERR that is wrong.
>
>   > Generated by: scripts/coccinelle/tests/odd_ptr_err.cocci
>
>   > CC: Songjun Wu <songjun.wu@atmel.com>
>   > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
>   > ---
>
>   >  atmel-classd.c |    2 +-
>   >  1 file changed, 1 insertion(+), 1 deletion(-)
>
>   > --- a/sound/soc/atmel/atmel-classd.c
>   > +++ b/sound/soc/atmel/atmel-classd.c
>   > @@ -576,7 +576,7 @@ static int atmel_classd_probe(struct pla
>
>   dd-> gclk = devm_clk_get(dev, "gclk");
>   >  	if (IS_ERR(dd->aclk)) {
>   > -		ret = PTR_ERR(dd->gclk);
>   > +		ret = PTR_ERR(dd->aclk);
>
> It looks like it is the other way around. It should test
> IS_ERR(dd->gclk) instead.
>
Thank you, you are right.
It should test IS_ERR(dd->gclk) instead.
diff mbox

Patch

--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -576,7 +576,7 @@  static int atmel_classd_probe(struct pla
 
 	dd->gclk = devm_clk_get(dev, "gclk");
 	if (IS_ERR(dd->aclk)) {
-		ret = PTR_ERR(dd->gclk);
+		ret = PTR_ERR(dd->aclk);
 		dev_err(dev, "failed to get GCK clock: %d\n", ret);
 		return ret;
 	}