[linusw-gpio:b4/descriptors-regulators 3/6] drivers/regulator/da9055-regulator.c:481 da9055_gpio_init() error: uninitialized symbol 'ret'.

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

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git b4/descriptors-regulators
head:   70f1ac1c0e32e3d7fb546eac70f113bd57b659fa
commit: db93c3de09384ee1d48a99bb103a49938f80e046 [3/6] regulator: da9055: Fully convert to GPIO descriptors
config: nios2-randconfig-r071-20240219 (https://download.01.org/0day-ci/archive/20240220/202402200604.tilWhpaa-lkp@xxxxxxxxx/config)
compiler: nios2-linux-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202402200604.tilWhpaa-lkp@xxxxxxxxx/

smatch warnings:
drivers/regulator/da9055-regulator.c:481 da9055_gpio_init() error: uninitialized symbol 'ret'.

vim +/ret +481 drivers/regulator/da9055-regulator.c

db93c3de09384e Linus Walleij 2024-02-15  415  static int da9055_gpio_init(struct device *dev,
db93c3de09384e Linus Walleij 2024-02-15  416  			    struct da9055_regulator *regulator,
f6130be652d0b4 Ashish Jangam 2012-11-01  417  			    struct regulator_config *config,
f6130be652d0b4 Ashish Jangam 2012-11-01  418  			    struct da9055_pdata *pdata, int id)
f6130be652d0b4 Ashish Jangam 2012-11-01  419  {
f6130be652d0b4 Ashish Jangam 2012-11-01  420  	struct da9055_regulator_info *info = regulator->info;
db93c3de09384e Linus Walleij 2024-02-15  421  	struct gpio_desc *ren;
db93c3de09384e Linus Walleij 2024-02-15  422  	struct gpio_desc *ena;
db93c3de09384e Linus Walleij 2024-02-15  423  	struct gpio_desc *rsel;
db93c3de09384e Linus Walleij 2024-02-15  424  	int ret;
f6130be652d0b4 Ashish Jangam 2012-11-01  425  
db93c3de09384e Linus Walleij 2024-02-15  426  	/* Look for "regulator-enable-gpios" GPIOs in the regulator node */
db93c3de09384e Linus Walleij 2024-02-15  427  	ren = devm_gpiod_get_optional(dev, "regulator-enable", GPIOD_IN);

If both devm_gpiod_get_optional() calls return NULL then "ret" ends up
being uninitialized.

db93c3de09384e Linus Walleij 2024-02-15  428  	if (IS_ERR(ren))
db93c3de09384e Linus Walleij 2024-02-15  429  		return PTR_ERR(ren);
8b61a28d616a34 Adam Thomson  2014-02-06  430  
db93c3de09384e Linus Walleij 2024-02-15  431  	if (ren) {
db93c3de09384e Linus Walleij 2024-02-15  432  		/* This GPIO is not optional at this point */
db93c3de09384e Linus Walleij 2024-02-15  433  		ena = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
db93c3de09384e Linus Walleij 2024-02-15  434  		if (IS_ERR(ena))
db93c3de09384e Linus Walleij 2024-02-15  435  			return PTR_ERR(ena);
f6130be652d0b4 Ashish Jangam 2012-11-01  436  
db93c3de09384e Linus Walleij 2024-02-15  437  		config->ena_gpiod = ena;
f6130be652d0b4 Ashish Jangam 2012-11-01  438  
f6130be652d0b4 Ashish Jangam 2012-11-01  439  		/*
f6130be652d0b4 Ashish Jangam 2012-11-01  440  		 * GPI pin is muxed with regulator to control the
f6130be652d0b4 Ashish Jangam 2012-11-01  441  		 * regulator state.
f6130be652d0b4 Ashish Jangam 2012-11-01  442  		 */
db93c3de09384e Linus Walleij 2024-02-15  443  		gpiod_set_consumer_name(ren, "DA9055 ren GPI");
f6130be652d0b4 Ashish Jangam 2012-11-01  444  
f6130be652d0b4 Ashish Jangam 2012-11-01  445  		/*
f6130be652d0b4 Ashish Jangam 2012-11-01  446  		 * Let the regulator know that its state is controlled
f6130be652d0b4 Ashish Jangam 2012-11-01  447  		 * through GPI.
f6130be652d0b4 Ashish Jangam 2012-11-01  448  		 */
f6130be652d0b4 Ashish Jangam 2012-11-01  449  		ret = da9055_reg_update(regulator->da9055, info->conf.reg,
f6130be652d0b4 Ashish Jangam 2012-11-01  450  					DA9055_E_GPI_MASK,
f6130be652d0b4 Ashish Jangam 2012-11-01  451  					pdata->reg_ren[id]
f6130be652d0b4 Ashish Jangam 2012-11-01  452  					<< DA9055_E_GPI_SHIFT);
f6130be652d0b4 Ashish Jangam 2012-11-01  453  		if (ret < 0)
db93c3de09384e Linus Walleij 2024-02-15  454  			return ret;
f6130be652d0b4 Ashish Jangam 2012-11-01  455  	}
f6130be652d0b4 Ashish Jangam 2012-11-01  456  
db93c3de09384e Linus Walleij 2024-02-15  457  	/* Look for "regulator-select-gpios" GPIOs in the regulator node */
db93c3de09384e Linus Walleij 2024-02-15  458  	rsel = devm_gpiod_get_optional(dev, "regulator-select", GPIOD_IN);
db93c3de09384e Linus Walleij 2024-02-15  459  	if (IS_ERR(rsel))
db93c3de09384e Linus Walleij 2024-02-15  460  		return PTR_ERR(rsel);
f6130be652d0b4 Ashish Jangam 2012-11-01  461  
db93c3de09384e Linus Walleij 2024-02-15  462  	if (rsel) {
f6130be652d0b4 Ashish Jangam 2012-11-01  463  		regulator->reg_rselect = pdata->reg_rsel[id];
f6130be652d0b4 Ashish Jangam 2012-11-01  464  
f6130be652d0b4 Ashish Jangam 2012-11-01  465  		/*
f6130be652d0b4 Ashish Jangam 2012-11-01  466  		 * GPI pin is muxed with regulator to select the
f6130be652d0b4 Ashish Jangam 2012-11-01  467  		 * regulator register set A/B for voltage ramping.
f6130be652d0b4 Ashish Jangam 2012-11-01  468  		 */
db93c3de09384e Linus Walleij 2024-02-15  469  		gpiod_set_consumer_name(rsel, "DA9055 rsel GPI");
f6130be652d0b4 Ashish Jangam 2012-11-01  470  
f6130be652d0b4 Ashish Jangam 2012-11-01  471  		/*
f6130be652d0b4 Ashish Jangam 2012-11-01  472  		 * Let the regulator know that its register set A/B
f6130be652d0b4 Ashish Jangam 2012-11-01  473  		 * will be selected through GPI for voltage ramping.
f6130be652d0b4 Ashish Jangam 2012-11-01  474  		 */
f6130be652d0b4 Ashish Jangam 2012-11-01  475  		ret = da9055_reg_update(regulator->da9055, info->conf.reg,
f6130be652d0b4 Ashish Jangam 2012-11-01  476  					DA9055_V_GPI_MASK,
f6130be652d0b4 Ashish Jangam 2012-11-01  477  					pdata->reg_rsel[id]
f6130be652d0b4 Ashish Jangam 2012-11-01  478  					<< DA9055_V_GPI_SHIFT);
f6130be652d0b4 Ashish Jangam 2012-11-01  479  	}
f6130be652d0b4 Ashish Jangam 2012-11-01  480  
f6130be652d0b4 Ashish Jangam 2012-11-01 @481  	return ret;
f6130be652d0b4 Ashish Jangam 2012-11-01  482  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux