[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <202007100247.bJq2hgt6%lkp@intel.com>
Date: Fri, 10 Jul 2020 02:29:49 +0800
From: kernel test robot <lkp@...el.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Linus Walleij <linus.walleij@...aro.org>
Subject: drivers/pinctrl/pinctrl-mcp23s08_spi.c:129:1-3: WARNING:
PTR_ERR_OR_ZERO can be used
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@...el.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
Download attachment ".config.gz" of type "application/gzip" (33014 bytes)
Powered by blists - more mailing lists