tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 5469f0c06732a077c70a759a81f2a1f00b277694 commit: 36b6ea0fc6bcbc618fe20d33a3b529a6d0653d99 [7267/7959] firmware: arm_scmi: Add iterators for multi-part commands config: arm64-randconfig-m031-20220429 (https://download.01.org/0day-ci/archive/20220430/202204300741.1Vg3IhCp-lkp@xxxxxxxxx/config) compiler: aarch64-linux-gcc (GCC) 11.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@xxxxxxxxx> Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> smatch warnings: drivers/firmware/arm_scmi/driver.c:1214 scmi_iterator_run() warn: variable dereferenced before check 'i' (see line 1210) vim +/i +1214 drivers/firmware/arm_scmi/driver.c 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1205 static int scmi_iterator_run(void *iter) 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1206 { 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1207 int ret = -EINVAL; 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1208 struct scmi_iterator *i = iter; 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1209 struct scmi_iterator_state *st = &i->state; 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 @1210 struct scmi_iterator_ops *iops = i->ops; ^^^^^^^ Dereference 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1211 const struct scmi_protocol_handle *ph = i->ph; 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1212 const struct scmi_xfer_ops *xops = ph->xops; 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1213 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 @1214 if (!i) ^^^ Checked too late 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1215 return ret; 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1216 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1217 do { 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1218 iops->prepare_message(i->msg, st->desc_index, i->priv); 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1219 ret = xops->do_xfer(ph, i->t); 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1220 if (ret) 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1221 break; 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1222 36b6ea0fc6bcbc Cristian Marussi 2022-03-30 1223 ret = iops->update_state(st, i->resp, i->priv); -- 0-DAY CI Kernel Test Service https://01.org/lkp