Skip to contentSkip to conversation

drivers/iio/light/vcnl4000.c:153 vcnl4200_set_power_state() warn: ignoring unreachable code.

PATCH New Dan Carpenter 1 participant 1 message Feb 7, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 16/16 drivers/iio/light/vcnl4000.c:153 vcnl4200_set_power_state() warn: ignoring unreachable code.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git testing
head:   ce08fb79f9c866d1fe6dba977a32954cdc444059
commit: ce08fb79f9c866d1fe6dba977a32954cdc444059 [16/16] iio: vcnl4000: Enable runtime pm for vcnl4200/4040

If you fix the issue, kindly add following tag

smatch warnings:
drivers/iio/light/vcnl4000.c:153 vcnl4200_set_power_state() warn: ignoring unreachable code.

# https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git/commit/?id=ce08fb79f9c866d1fe6dba977a32954cdc444059
git remote add iio https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git
git remote update iio
git checkout ce08fb79f9c866d1fe6dba977a32954cdc444059
vim +153 drivers/iio/light/vcnl4000.c

be38866fbb97f0e Tomas Novotny 2018-07-25 142

ce08fb79f9c866d Guido Günther 2020-02-03  143  static int vcnl4200_set_power_state(struct vcnl4000_data *data, bool on)
ce08fb79f9c866d Guido Günther 2020-02-03  144  {
ce08fb79f9c866d Guido Günther 2020-02-03  145  	u16 val = on ? 0 /* power on */ : 1 /* shut down */;
ce08fb79f9c866d Guido Günther 2020-02-03  146  	int ret;
ce08fb79f9c866d Guido Günther 2020-02-03  147  
ce08fb79f9c866d Guido Günther 2020-02-03  148  	ret = i2c_smbus_write_word_data(data->client, VCNL4200_AL_CONF, val);
ce08fb79f9c866d Guido Günther 2020-02-03  149  	if (ret < 0)
ce08fb79f9c866d Guido Günther 2020-02-03  150  		return ret;
ce08fb79f9c866d Guido Günther 2020-02-03  151  
ce08fb79f9c866d Guido Günther 2020-02-03  152  	return i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
                                                ^^^^^^^^^^^^^^^

ret =

ce08fb79f9c866d Guido Günther 2020-02-03 @153 if (ret < 0)

ce08fb79f9c866d Guido Günther 2020-02-03  154  		return ret;
ce08fb79f9c866d Guido Günther 2020-02-03  155  
ce08fb79f9c866d Guido Günther 2020-02-03  156  	if (on) {
ce08fb79f9c866d Guido Günther 2020-02-03  157  		/* Wait@least one integration cycle before fetching data */
ce08fb79f9c866d Guido Günther 2020-02-03  158  		data->vcnl4200_al.last_measurement = ktime_get();
ce08fb79f9c866d Guido Günther 2020-02-03  159  		data->vcnl4200_ps.last_measurement = ktime_get();
ce08fb79f9c866d Guido Günther 2020-02-03  160  	}
ce08fb79f9c866d Guido Günther 2020-02-03  161  
ce08fb79f9c866d Guido Günther 2020-02-03  162  	return 0;
ce08fb79f9c866d Guido Günther 2020-02-03  163  }
ce08fb79f9c866d Guido Günther 2020-02-03  164  

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