linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2020-06-08  1:02 kernel test robot
  2020-06-08  1:02 ` [PATCH] pinctrl: mcp23s08: Split to three parts: fix ptr_ret.cocci warnings kernel test robot
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2020-06-08  1:02 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: kbuild-all, linux-kernel, Linus Walleij

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cf0c97f148e9e50aa5a7ddd1984a604dd2bde4af
commit: 0f04a81784fe3ddc00cae74c517265b3ddb8825c pinctrl: mcp23s08: Split to three parts: core, I²C, SPI
date:   8 weeks ago
config: parisc-randconfig-c021-20200607 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used

Please review and possibly fold the followup patch.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 26441 bytes --]

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

* [PATCH] pinctrl: mcp23s08: Split to three parts: fix ptr_ret.cocci warnings
  2020-06-08  1:02 drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used kernel test robot
@ 2020-06-08  1:02 ` kernel test robot
  2020-06-08  3:58   ` Andy Shevchenko
  2020-06-10 11:09   ` Linus Walleij
  0 siblings, 2 replies; 6+ messages in thread
From: kernel test robot @ 2020-06-08  1:02 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: kbuild-all, linux-kernel, Linus Walleij, linux-gpio

From: kernel test robot <lkp@intel.com>

drivers/pinctrl/pinctrl-mcp23s08_spi.c:129: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: 0f04a81784fe ("pinctrl: mcp23s08: Split to three parts: core, I²C, SPI")
CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: kernel test robot <lkp@intel.com>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   cf0c97f148e9e50aa5a7ddd1984a604dd2bde4af
commit: 0f04a81784fe3ddc00cae74c517265b3ddb8825c pinctrl: mcp23s08: Split to three parts: core, I²C, SPI

 pinctrl-mcp23s08_spi.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

--- a/drivers/pinctrl/pinctrl-mcp23s08_spi.c
+++ b/drivers/pinctrl/pinctrl-mcp23s08_spi.c
@@ -126,10 +126,7 @@ static int mcp23s08_spi_regmap_init(stru
 	copy->name = name;
 
 	mcp->regmap = devm_regmap_init(dev, &mcp23sxx_spi_regmap, mcp, copy);
-	if (IS_ERR(mcp->regmap))
-		return PTR_ERR(mcp->regmap);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(mcp->regmap);
 }
 
 static int mcp23s08_probe(struct spi_device *spi)

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

* Re: [PATCH] pinctrl: mcp23s08: Split to three parts: fix ptr_ret.cocci warnings
  2020-06-08  1:02 ` [PATCH] pinctrl: mcp23s08: Split to three parts: fix ptr_ret.cocci warnings kernel test robot
@ 2020-06-08  3:58   ` Andy Shevchenko
  2020-06-10 11:09   ` Linus Walleij
  1 sibling, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-06-08  3:58 UTC (permalink / raw)
  To: kernel test robot; +Cc: kbuild-all, linux-kernel, Linus Walleij, linux-gpio

On Mon, Jun 08, 2020 at 09:02:53AM +0800, kernel test robot wrote:
> From: kernel test robot <lkp@intel.com>
> 
> drivers/pinctrl/pinctrl-mcp23s08_spi.c:129: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

Makes sense.
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 
> Fixes: 0f04a81784fe ("pinctrl: mcp23s08: Split to three parts: core, I²C, SPI")
> CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>
> ---
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   cf0c97f148e9e50aa5a7ddd1984a604dd2bde4af
> commit: 0f04a81784fe3ddc00cae74c517265b3ddb8825c pinctrl: mcp23s08: Split to three parts: core, I²C, SPI
> 
>  pinctrl-mcp23s08_spi.c |    5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> --- a/drivers/pinctrl/pinctrl-mcp23s08_spi.c
> +++ b/drivers/pinctrl/pinctrl-mcp23s08_spi.c
> @@ -126,10 +126,7 @@ static int mcp23s08_spi_regmap_init(stru
>  	copy->name = name;
>  
>  	mcp->regmap = devm_regmap_init(dev, &mcp23sxx_spi_regmap, mcp, copy);
> -	if (IS_ERR(mcp->regmap))
> -		return PTR_ERR(mcp->regmap);
> -
> -	return 0;
> +	return PTR_ERR_OR_ZERO(mcp->regmap);
>  }
>  
>  static int mcp23s08_probe(struct spi_device *spi)

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH] pinctrl: mcp23s08: Split to three parts: fix ptr_ret.cocci warnings
  2020-06-08  1:02 ` [PATCH] pinctrl: mcp23s08: Split to three parts: fix ptr_ret.cocci warnings kernel test robot
  2020-06-08  3:58   ` Andy Shevchenko
@ 2020-06-10 11:09   ` Linus Walleij
  1 sibling, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2020-06-10 11:09 UTC (permalink / raw)
  To: kernel test robot
  Cc: Andy Shevchenko, kbuild-all, linux-kernel, open list:GPIO SUBSYSTEM

On Mon, Jun 8, 2020 at 3:03 AM kernel test robot <lkp@intel.com> wrote:

> From: kernel test robot <lkp@intel.com>
>
> drivers/pinctrl/pinctrl-mcp23s08_spi.c:129: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: 0f04a81784fe ("pinctrl: mcp23s08: Split to three parts: core, I涎, SPI")
> CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: kernel test robot <lkp@intel.com>

Patch applied with Andy's ACK.

Yours,
Linus Walleij

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

* Re: drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used
  2020-07-09 18:29 drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used kernel test robot
@ 2020-07-09 20:02 ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2020-07-09 20:02 UTC (permalink / raw)
  To: kernel test robot
  Cc: Andy Shevchenko, kbuild-all, Linux Kernel Mailing List, Linus Walleij

On Thu, Jul 9, 2020 at 9:34 PM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   0bddd227f3dc55975e2b8dfa7fc6f959b062a2c7
> commit: 0f04a81784fe3ddc00cae74c517265b3ddb8825c pinctrl: mcp23s08: Split to three parts: core, I涎, SPI
> date:   3 months ago
> config: i386-randconfig-c001-20200709 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>

>    128          mcp->regmap = devm_regmap_init(dev, &mcp23sxx_spi_regmap, mcp, copy);
>  > 129          if (IS_ERR(mcp->regmap))
>    130                  return PTR_ERR(mcp->regmap);
>    131
>    132          return 0;

Right.

I expect LKP to generate such patches and submit :-)

-- 
With Best Regards,
Andy Shevchenko

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

* drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used
@ 2020-07-09 18:29 kernel test robot
  2020-07-09 20:02 ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2020-07-09 18:29 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: kbuild-all, linux-kernel, Linus Walleij

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   0bddd227f3dc55975e2b8dfa7fc6f959b062a2c7
commit: 0f04a81784fe3ddc00cae74c517265b3ddb8825c pinctrl: mcp23s08: Split to three parts: core, I²C, SPI
date:   3 months ago
config: i386-randconfig-c001-20200709 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used

vim +129 drivers/pinctrl/pinctrl-mcp23s08_spi.c

    81	
    82	static int mcp23s08_spi_regmap_init(struct mcp23s08 *mcp, struct device *dev,
    83					    unsigned int addr, unsigned int type)
    84	{
    85		const struct regmap_config *config;
    86		struct regmap_config *copy;
    87		const char *name;
    88	
    89		switch (type) {
    90		case MCP_TYPE_S08:
    91			mcp->reg_shift = 0;
    92			mcp->chip.ngpio = 8;
    93			mcp->chip.label = devm_kasprintf(dev, GFP_KERNEL, "mcp23s08.%d", addr);
    94	
    95			config = &mcp23x08_regmap;
    96			name = devm_kasprintf(dev, GFP_KERNEL, "%d", addr);
    97			break;
    98	
    99		case MCP_TYPE_S17:
   100			mcp->reg_shift = 1;
   101			mcp->chip.ngpio = 16;
   102			mcp->chip.label = devm_kasprintf(dev, GFP_KERNEL, "mcp23s17.%d", addr);
   103	
   104			config = &mcp23x17_regmap;
   105			name = devm_kasprintf(dev, GFP_KERNEL, "%d", addr);
   106			break;
   107	
   108		case MCP_TYPE_S18:
   109			mcp->reg_shift = 1;
   110			mcp->chip.ngpio = 16;
   111			mcp->chip.label = "mcp23s18";
   112	
   113			config = &mcp23x17_regmap;
   114			name = config->name;
   115			break;
   116	
   117		default:
   118			dev_err(dev, "invalid device type (%d)\n", type);
   119			return -EINVAL;
   120		}
   121	
   122		copy = devm_kmemdup(dev, &config, sizeof(config), GFP_KERNEL);
   123		if (!copy)
   124			return -ENOMEM;
   125	
   126		copy->name = name;
   127	
   128		mcp->regmap = devm_regmap_init(dev, &mcp23sxx_spi_regmap, mcp, copy);
 > 129		if (IS_ERR(mcp->regmap))
   130			return PTR_ERR(mcp->regmap);
   131	
   132		return 0;
   133	}
   134	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33014 bytes --]

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

end of thread, other threads:[~2020-07-09 20:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08  1:02 drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used kernel test robot
2020-06-08  1:02 ` [PATCH] pinctrl: mcp23s08: Split to three parts: fix ptr_ret.cocci warnings kernel test robot
2020-06-08  3:58   ` Andy Shevchenko
2020-06-10 11:09   ` Linus Walleij
2020-07-09 18:29 drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used kernel test robot
2020-07-09 20:02 ` Andy Shevchenko

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