[bug report] mfd: ene-kb3930: Add driver for ENE KB3930 Embedded Controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Lubomir Rintel,

The patch 753bd752e181: "mfd: ene-kb3930: Add driver for ENE KB3930
Embedded Controller" from Jul 10, 2020, leads to the following static
checker warning:

	drivers/mfd/ene-kb3930.c:165 kb3930_probe()
	warn: 'ddata->off_gpios' can also be NULL

drivers/mfd/ene-kb3930.c
   152  
   153          ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO,
   154                                     ariel_ec_cells,
   155                                     ARRAY_SIZE(ariel_ec_cells),
   156                                     NULL, 0, NULL);
   157          if (ret)
   158                  return ret;
   159  
   160          if (of_property_read_bool(np, "system-power-controller")) {
   161                  ddata->off_gpios =
   162                          devm_gpiod_get_array_optional(dev, "off", GPIOD_IN);

The devm_gpiod_get_array_optional() function can return NULL in the
sitation where the optional array is not there.  It's not an error
because it's an optional thing, but there is also no valid pointer to
return.  So because it's not an error pointer, or a valid pointer then
it's NULL.

   163                  if (IS_ERR(ddata->off_gpios))
   164                          return PTR_ERR(ddata->off_gpios);
   165                  if (ddata->off_gpios->ndescs < 2) {
   166                          dev_err(dev, "invalid off-gpios property\n");
   167                          return -EINVAL;
   168                  }
   169          }
   170  
   171          if (ddata->off_gpios) {
   172                  register_restart_handler(&kb3930_restart_nb);
   173                  if (!pm_power_off)
   174                          pm_power_off = kb3930_pm_power_off;
   175          }
   176  
   177          return 0;

regards,
dan carpenter



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux