linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>
Subject: drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used
Date: Fri, 10 Jul 2020 02:29:49 +0800	[thread overview]
Message-ID: <202007100247.bJq2hgt6%lkp@intel.com> (raw)

[-- 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 --]

             reply	other threads:[~2020-07-09 18:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-09 18:29 kernel test robot [this message]
2020-07-09 20:02 ` drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING: PTR_ERR_OR_ZERO can be used Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2020-06-08  1:02 kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202007100247.bJq2hgt6%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).