Re: [PATCH v8 3/7] mfd: Add base driver for Netronix embedded controller

From: kernel test robot
Date: Sat Jan 16 2021 - 20:28:35 EST


Hi "Jonathan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on robh/for-next pwm/for-next abelloni/rtc-next linus/master v5.11-rc3 next-20210115]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Jonathan-Neusch-fer/Netronix-embedded-controller-driver-for-Kobo-and-Tolino-ebook-readers/20210117-050203
base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: mips-randconfig-r001-20210117 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 2082b10d100e8dbaffc2ba8f497db5d2ab61beb2)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/eee80e6b3b7cc2c733bd3f10d8e2ec23dda2fe26
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jonathan-Neusch-fer/Netronix-embedded-controller-driver-for-Kobo-and-Tolino-ebook-readers/20210117-050203
git checkout eee80e6b3b7cc2c733bd3f10d8e2ec23dda2fe26
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips

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

All warnings (new ones prefixed by >>):

>> drivers/mfd/ntxec.c:127:10: warning: variable 'res' is uninitialized when used here [-Wuninitialized]
return res;
^~~
drivers/mfd/ntxec.c:116:9: note: initialize the variable 'res' to silence this warning
int res;
^
= 0
1 warning generated.


vim +/res +127 drivers/mfd/ntxec.c

111
112 static int ntxec_probe(struct i2c_client *client)
113 {
114 struct ntxec *ec;
115 unsigned int version;
116 int res;
117
118 ec = devm_kmalloc(&client->dev, sizeof(*ec), GFP_KERNEL);
119 if (!ec)
120 return -ENOMEM;
121
122 ec->dev = &client->dev;
123
124 ec->regmap = devm_regmap_init_i2c(client, &regmap_config);
125 if (IS_ERR(ec->regmap)) {
126 dev_err(ec->dev, "Failed to set up regmap for device\n");
> 127 return res;
128 }
129
130 /* Determine the firmware version */
131 res = regmap_read(ec->regmap, NTXEC_REG_VERSION, &version);
132 if (res < 0) {
133 dev_err(ec->dev, "Failed to read firmware version number\n");
134 return res;
135 }
136
137 /* Bail out if we encounter an unknown firmware version */
138 switch (version) {
139 case NTXEC_VERSION_KOBO_AURA:
140 break;
141 default:
142 dev_err(ec->dev,
143 "Netronix embedded controller version %04x is not supported.\n",
144 version);
145 return -ENODEV;
146 }
147
148 dev_info(ec->dev,
149 "Netronix embedded controller version %04x detected.\n", version);
150
151 if (of_device_is_system_power_controller(ec->dev->of_node)) {
152 /*
153 * Set the 'powerkeep' bit. This is necessary on some boards
154 * in order to keep the system running.
155 */
156 res = regmap_write(ec->regmap, NTXEC_REG_POWERKEEP,
157 NTXEC_POWERKEEP_VALUE);
158 if (res < 0)
159 return res;
160
161 if (poweroff_restart_client)
162 /*
163 * Another instance of the driver already took
164 * poweroff/restart duties.
165 */
166 dev_err(ec->dev, "poweroff_restart_client already assigned\n");
167 else
168 poweroff_restart_client = client;
169
170 if (pm_power_off)
171 /* Another driver already registered a poweroff handler. */
172 dev_err(ec->dev, "pm_power_off already assigned\n");
173 else
174 pm_power_off = ntxec_poweroff;
175
176 res = register_restart_handler(&ntxec_restart_handler);
177 if (res)
178 dev_err(ec->dev,
179 "Failed to register restart handler: %d\n", res);
180 }
181
182 i2c_set_clientdata(client, ec);
183
184 res = devm_mfd_add_devices(ec->dev, PLATFORM_DEVID_NONE, ntxec_subdevices,
185 ARRAY_SIZE(ntxec_subdevices), NULL, 0, NULL);
186 if (res)
187 dev_err(ec->dev, "Failed to add subdevices: %d\n", res);
188
189 return res;
190 }
191

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

Attachment: .config.gz
Description: application/gzip