Linux-Hwmon Archive on lore.kernel.org
 help / color / Atom feed
* [hwmon:hwmon-playground 130/134] drivers/hwmon/max6650.c:632:4-10: preceding lock on line 616 (fwd)
@ 2019-04-23 20:09 Julia Lawall
  2019-04-23 20:56 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2019-04-23 20:09 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: linux-hwmon, kbuild-all

Hello,

It looks like a goto may be wanted on line 632.

julia

---------- Forwarded message ----------
Date: Wed, 24 Apr 2019 03:38:39 +0800
From: kbuild test robot <lkp@intel.com>
To: kbuild@01.org
Cc: Julia Lawall <julia.lawall@lip6.fr>
Subject: [hwmon:hwmon-playground 130/134] drivers/hwmon/max6650.c:632:4-10:
    preceding lock on line 616

CC: kbuild-all@01.org
CC: linux-hwmon@vger.kernel.org
TO: Guenter Roeck <linux@roeck-us.net>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-playground
head:   05d763050bbaa40daa4b60a3912c9311ca5791a5
commit: 77d270a1d4db919db0b02fec1d85ad5a57d556d7 [130/134] hwmon: (max6650) Convert to use devm_hwmon_device_register_with_info
:::::: branch date: 6 hours ago
:::::: commit date: 6 hours ago

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>


>> drivers/hwmon/max6650.c:632:4-10: preceding lock on line 616

# https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=77d270a1d4db919db0b02fec1d85ad5a57d556d7
git remote add hwmon https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
git remote update hwmon
git checkout 77d270a1d4db919db0b02fec1d85ad5a57d556d7
vim +632 drivers/hwmon/max6650.c

77d270a1d Guenter Roeck 2019-04-20  608
77d270a1d Guenter Roeck 2019-04-20  609  static int max6650_write(struct device *dev, enum hwmon_sensor_types type,
77d270a1d Guenter Roeck 2019-04-20  610  			 u32 attr, int channel, long val)
77d270a1d Guenter Roeck 2019-04-20  611  {
77d270a1d Guenter Roeck 2019-04-20  612  	struct max6650_data *data = dev_get_drvdata(dev);
77d270a1d Guenter Roeck 2019-04-20  613  	int ret = 0;
77d270a1d Guenter Roeck 2019-04-20  614  	u8 reg;
77d270a1d Guenter Roeck 2019-04-20  615
77d270a1d Guenter Roeck 2019-04-20 @616  	mutex_lock(&data->update_lock);
77d270a1d Guenter Roeck 2019-04-20  617
77d270a1d Guenter Roeck 2019-04-20  618  	switch (type) {
77d270a1d Guenter Roeck 2019-04-20  619  	case hwmon_pwm:
77d270a1d Guenter Roeck 2019-04-20  620  		switch (attr) {
77d270a1d Guenter Roeck 2019-04-20  621  		case hwmon_pwm_input:
77d270a1d Guenter Roeck 2019-04-20  622  			reg = pwm_to_dac(clamp_val(val, 0, 255),
77d270a1d Guenter Roeck 2019-04-20  623  					 data->config & MAX6650_CFG_V12);
77d270a1d Guenter Roeck 2019-04-20  624  			ret = i2c_smbus_write_byte_data(data->client,
77d270a1d Guenter Roeck 2019-04-20  625  							MAX6650_REG_DAC, reg);
77d270a1d Guenter Roeck 2019-04-20  626  			if (ret)
77d270a1d Guenter Roeck 2019-04-20  627  				break;
77d270a1d Guenter Roeck 2019-04-20  628  			data->dac = reg;
77d270a1d Guenter Roeck 2019-04-20  629  			break;
77d270a1d Guenter Roeck 2019-04-20  630  		case hwmon_pwm_enable:
77d270a1d Guenter Roeck 2019-04-20  631  			if (val < 0 || val >= ARRAY_SIZE(max6650_pwm_modes))
77d270a1d Guenter Roeck 2019-04-20 @632  				return -EINVAL;
77d270a1d Guenter Roeck 2019-04-20  633  			ret = max6650_set_operating_mode(data,
77d270a1d Guenter Roeck 2019-04-20  634  						max6650_pwm_modes[val]);
77d270a1d Guenter Roeck 2019-04-20  635  			break;
77d270a1d Guenter Roeck 2019-04-20  636  		default:
77d270a1d Guenter Roeck 2019-04-20  637  			ret = -EOPNOTSUPP;
77d270a1d Guenter Roeck 2019-04-20  638  			break;
77d270a1d Guenter Roeck 2019-04-20  639  		}
77d270a1d Guenter Roeck 2019-04-20  640  	case hwmon_fan:
77d270a1d Guenter Roeck 2019-04-20  641  		switch (attr) {
77d270a1d Guenter Roeck 2019-04-20  642  		case hwmon_fan_div:
77d270a1d Guenter Roeck 2019-04-20  643  			switch (val) {
77d270a1d Guenter Roeck 2019-04-20  644  			case 1:
77d270a1d Guenter Roeck 2019-04-20  645  				reg = 0;
77d270a1d Guenter Roeck 2019-04-20  646  				break;
77d270a1d Guenter Roeck 2019-04-20  647  			case 2:
77d270a1d Guenter Roeck 2019-04-20  648  				reg = 1;
77d270a1d Guenter Roeck 2019-04-20  649  				break;
77d270a1d Guenter Roeck 2019-04-20  650  			case 4:
77d270a1d Guenter Roeck 2019-04-20  651  				reg = 2;
77d270a1d Guenter Roeck 2019-04-20  652  				break;
77d270a1d Guenter Roeck 2019-04-20  653  			case 8:
77d270a1d Guenter Roeck 2019-04-20  654  				reg = 3;
77d270a1d Guenter Roeck 2019-04-20  655  				break;
77d270a1d Guenter Roeck 2019-04-20  656  			default:
77d270a1d Guenter Roeck 2019-04-20  657  				ret = -EINVAL;
77d270a1d Guenter Roeck 2019-04-20  658  				goto error;
77d270a1d Guenter Roeck 2019-04-20  659  			}
77d270a1d Guenter Roeck 2019-04-20  660  			ret = i2c_smbus_write_byte_data(data->client,
77d270a1d Guenter Roeck 2019-04-20  661  							MAX6650_REG_COUNT, reg);
77d270a1d Guenter Roeck 2019-04-20  662  			if (ret)
77d270a1d Guenter Roeck 2019-04-20  663  				break;
77d270a1d Guenter Roeck 2019-04-20  664  			data->count = reg;
77d270a1d Guenter Roeck 2019-04-20  665  			break;
77d270a1d Guenter Roeck 2019-04-20  666  		case hwmon_fan_target:
77d270a1d Guenter Roeck 2019-04-20  667  			if (val < 0) {
77d270a1d Guenter Roeck 2019-04-20  668  				ret = -EINVAL;
77d270a1d Guenter Roeck 2019-04-20  669  				break;
77d270a1d Guenter Roeck 2019-04-20  670  			}
77d270a1d Guenter Roeck 2019-04-20  671  			ret = max6650_set_target(data, val);
77d270a1d Guenter Roeck 2019-04-20  672  			break;
77d270a1d Guenter Roeck 2019-04-20  673  		default:
77d270a1d Guenter Roeck 2019-04-20  674  			ret = -EOPNOTSUPP;
77d270a1d Guenter Roeck 2019-04-20  675  			break;
77d270a1d Guenter Roeck 2019-04-20  676  		}
77d270a1d Guenter Roeck 2019-04-20  677  		break;
77d270a1d Guenter Roeck 2019-04-20  678  	default:
77d270a1d Guenter Roeck 2019-04-20  679  		ret = -EOPNOTSUPP;
77d270a1d Guenter Roeck 2019-04-20  680  		break;
77d270a1d Guenter Roeck 2019-04-20  681  	}
77d270a1d Guenter Roeck 2019-04-20  682
77d270a1d Guenter Roeck 2019-04-20  683  error:
77d270a1d Guenter Roeck 2019-04-20  684  	mutex_unlock(&data->update_lock);
77d270a1d Guenter Roeck 2019-04-20  685  	return ret;
77d270a1d Guenter Roeck 2019-04-20  686  }
77d270a1d Guenter Roeck 2019-04-20  687

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [hwmon:hwmon-playground 130/134] drivers/hwmon/max6650.c:632:4-10: preceding lock on line 616 (fwd)
  2019-04-23 20:09 [hwmon:hwmon-playground 130/134] drivers/hwmon/max6650.c:632:4-10: preceding lock on line 616 (fwd) Julia Lawall
@ 2019-04-23 20:56 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-04-23 20:56 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-hwmon, kbuild-all

On Tue, Apr 23, 2019 at 10:09:45PM +0200, Julia Lawall wrote:
> Hello,
> 
> It looks like a goto may be wanted on line 632.
> 
Looks like it ..

Thanks!

Guenter

> julia
> 
> ---------- Forwarded message ----------
> Date: Wed, 24 Apr 2019 03:38:39 +0800
> From: kbuild test robot <lkp@intel.com>
> To: kbuild@01.org
> Cc: Julia Lawall <julia.lawall@lip6.fr>
> Subject: [hwmon:hwmon-playground 130/134] drivers/hwmon/max6650.c:632:4-10:
>     preceding lock on line 616
> 
> CC: kbuild-all@01.org
> CC: linux-hwmon@vger.kernel.org
> TO: Guenter Roeck <linux@roeck-us.net>
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-playground
> head:   05d763050bbaa40daa4b60a3912c9311ca5791a5
> commit: 77d270a1d4db919db0b02fec1d85ad5a57d556d7 [130/134] hwmon: (max6650) Convert to use devm_hwmon_device_register_with_info
> :::::: branch date: 6 hours ago
> :::::: commit date: 6 hours ago
> 
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> 
> 
> >> drivers/hwmon/max6650.c:632:4-10: preceding lock on line 616
> 
> # https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=77d270a1d4db919db0b02fec1d85ad5a57d556d7
> git remote add hwmon https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
> git remote update hwmon
> git checkout 77d270a1d4db919db0b02fec1d85ad5a57d556d7
> vim +632 drivers/hwmon/max6650.c
> 
> 77d270a1d Guenter Roeck 2019-04-20  608
> 77d270a1d Guenter Roeck 2019-04-20  609  static int max6650_write(struct device *dev, enum hwmon_sensor_types type,
> 77d270a1d Guenter Roeck 2019-04-20  610  			 u32 attr, int channel, long val)
> 77d270a1d Guenter Roeck 2019-04-20  611  {
> 77d270a1d Guenter Roeck 2019-04-20  612  	struct max6650_data *data = dev_get_drvdata(dev);
> 77d270a1d Guenter Roeck 2019-04-20  613  	int ret = 0;
> 77d270a1d Guenter Roeck 2019-04-20  614  	u8 reg;
> 77d270a1d Guenter Roeck 2019-04-20  615
> 77d270a1d Guenter Roeck 2019-04-20 @616  	mutex_lock(&data->update_lock);
> 77d270a1d Guenter Roeck 2019-04-20  617
> 77d270a1d Guenter Roeck 2019-04-20  618  	switch (type) {
> 77d270a1d Guenter Roeck 2019-04-20  619  	case hwmon_pwm:
> 77d270a1d Guenter Roeck 2019-04-20  620  		switch (attr) {
> 77d270a1d Guenter Roeck 2019-04-20  621  		case hwmon_pwm_input:
> 77d270a1d Guenter Roeck 2019-04-20  622  			reg = pwm_to_dac(clamp_val(val, 0, 255),
> 77d270a1d Guenter Roeck 2019-04-20  623  					 data->config & MAX6650_CFG_V12);
> 77d270a1d Guenter Roeck 2019-04-20  624  			ret = i2c_smbus_write_byte_data(data->client,
> 77d270a1d Guenter Roeck 2019-04-20  625  							MAX6650_REG_DAC, reg);
> 77d270a1d Guenter Roeck 2019-04-20  626  			if (ret)
> 77d270a1d Guenter Roeck 2019-04-20  627  				break;
> 77d270a1d Guenter Roeck 2019-04-20  628  			data->dac = reg;
> 77d270a1d Guenter Roeck 2019-04-20  629  			break;
> 77d270a1d Guenter Roeck 2019-04-20  630  		case hwmon_pwm_enable:
> 77d270a1d Guenter Roeck 2019-04-20  631  			if (val < 0 || val >= ARRAY_SIZE(max6650_pwm_modes))
> 77d270a1d Guenter Roeck 2019-04-20 @632  				return -EINVAL;
> 77d270a1d Guenter Roeck 2019-04-20  633  			ret = max6650_set_operating_mode(data,
> 77d270a1d Guenter Roeck 2019-04-20  634  						max6650_pwm_modes[val]);
> 77d270a1d Guenter Roeck 2019-04-20  635  			break;
> 77d270a1d Guenter Roeck 2019-04-20  636  		default:
> 77d270a1d Guenter Roeck 2019-04-20  637  			ret = -EOPNOTSUPP;
> 77d270a1d Guenter Roeck 2019-04-20  638  			break;
> 77d270a1d Guenter Roeck 2019-04-20  639  		}
> 77d270a1d Guenter Roeck 2019-04-20  640  	case hwmon_fan:
> 77d270a1d Guenter Roeck 2019-04-20  641  		switch (attr) {
> 77d270a1d Guenter Roeck 2019-04-20  642  		case hwmon_fan_div:
> 77d270a1d Guenter Roeck 2019-04-20  643  			switch (val) {
> 77d270a1d Guenter Roeck 2019-04-20  644  			case 1:
> 77d270a1d Guenter Roeck 2019-04-20  645  				reg = 0;
> 77d270a1d Guenter Roeck 2019-04-20  646  				break;
> 77d270a1d Guenter Roeck 2019-04-20  647  			case 2:
> 77d270a1d Guenter Roeck 2019-04-20  648  				reg = 1;
> 77d270a1d Guenter Roeck 2019-04-20  649  				break;
> 77d270a1d Guenter Roeck 2019-04-20  650  			case 4:
> 77d270a1d Guenter Roeck 2019-04-20  651  				reg = 2;
> 77d270a1d Guenter Roeck 2019-04-20  652  				break;
> 77d270a1d Guenter Roeck 2019-04-20  653  			case 8:
> 77d270a1d Guenter Roeck 2019-04-20  654  				reg = 3;
> 77d270a1d Guenter Roeck 2019-04-20  655  				break;
> 77d270a1d Guenter Roeck 2019-04-20  656  			default:
> 77d270a1d Guenter Roeck 2019-04-20  657  				ret = -EINVAL;
> 77d270a1d Guenter Roeck 2019-04-20  658  				goto error;
> 77d270a1d Guenter Roeck 2019-04-20  659  			}
> 77d270a1d Guenter Roeck 2019-04-20  660  			ret = i2c_smbus_write_byte_data(data->client,
> 77d270a1d Guenter Roeck 2019-04-20  661  							MAX6650_REG_COUNT, reg);
> 77d270a1d Guenter Roeck 2019-04-20  662  			if (ret)
> 77d270a1d Guenter Roeck 2019-04-20  663  				break;
> 77d270a1d Guenter Roeck 2019-04-20  664  			data->count = reg;
> 77d270a1d Guenter Roeck 2019-04-20  665  			break;
> 77d270a1d Guenter Roeck 2019-04-20  666  		case hwmon_fan_target:
> 77d270a1d Guenter Roeck 2019-04-20  667  			if (val < 0) {
> 77d270a1d Guenter Roeck 2019-04-20  668  				ret = -EINVAL;
> 77d270a1d Guenter Roeck 2019-04-20  669  				break;
> 77d270a1d Guenter Roeck 2019-04-20  670  			}
> 77d270a1d Guenter Roeck 2019-04-20  671  			ret = max6650_set_target(data, val);
> 77d270a1d Guenter Roeck 2019-04-20  672  			break;
> 77d270a1d Guenter Roeck 2019-04-20  673  		default:
> 77d270a1d Guenter Roeck 2019-04-20  674  			ret = -EOPNOTSUPP;
> 77d270a1d Guenter Roeck 2019-04-20  675  			break;
> 77d270a1d Guenter Roeck 2019-04-20  676  		}
> 77d270a1d Guenter Roeck 2019-04-20  677  		break;
> 77d270a1d Guenter Roeck 2019-04-20  678  	default:
> 77d270a1d Guenter Roeck 2019-04-20  679  		ret = -EOPNOTSUPP;
> 77d270a1d Guenter Roeck 2019-04-20  680  		break;
> 77d270a1d Guenter Roeck 2019-04-20  681  	}
> 77d270a1d Guenter Roeck 2019-04-20  682
> 77d270a1d Guenter Roeck 2019-04-20  683  error:
> 77d270a1d Guenter Roeck 2019-04-20  684  	mutex_unlock(&data->update_lock);
> 77d270a1d Guenter Roeck 2019-04-20  685  	return ret;
> 77d270a1d Guenter Roeck 2019-04-20  686  }
> 77d270a1d Guenter Roeck 2019-04-20  687
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-23 20:09 [hwmon:hwmon-playground 130/134] drivers/hwmon/max6650.c:632:4-10: preceding lock on line 616 (fwd) Julia Lawall
2019-04-23 20:56 ` Guenter Roeck

Linux-Hwmon Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hwmon/0 linux-hwmon/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hwmon linux-hwmon/ https://lore.kernel.org/linux-hwmon \
		linux-hwmon@vger.kernel.org linux-hwmon@archiver.kernel.org
	public-inbox-index linux-hwmon


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hwmon


AGPL code for this site: git clone https://public-inbox.org/ public-inbox