All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
@ 2021-02-15 13:40 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-02-15 13:40 UTC (permalink / raw)
  To: kbuild, Linus Walleij
  Cc: lkp, kbuild-all, Linux Memory Management List, Jonathan Cameron,
	Andy Shevchenko

[-- Attachment #1: Type: text/plain, Size: 9969 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   07f7e57c63aaa2afb4ea31edef05e08699a63a00
commit: de8860b1ed4701ea7e6f760f02d79ca6a3b656a1 [2008/11103] iio: magnetometer: Add driver for Yamaha YAS530
config: x86_64-randconfig-m001-20210215 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'

vim +/ret +891 drivers/iio/magnetometer/yamaha-yas530.c

de8860b1ed4701 Linus Walleij 2020-12-24  816  static int yas5xx_probe(struct i2c_client *i2c,
de8860b1ed4701 Linus Walleij 2020-12-24  817  			const struct i2c_device_id *id)
de8860b1ed4701 Linus Walleij 2020-12-24  818  {
de8860b1ed4701 Linus Walleij 2020-12-24  819  	struct iio_dev *indio_dev;
de8860b1ed4701 Linus Walleij 2020-12-24  820  	struct device *dev = &i2c->dev;
de8860b1ed4701 Linus Walleij 2020-12-24  821  	struct yas5xx *yas5xx;
de8860b1ed4701 Linus Walleij 2020-12-24  822  	int ret;
de8860b1ed4701 Linus Walleij 2020-12-24  823  
de8860b1ed4701 Linus Walleij 2020-12-24  824  	indio_dev = devm_iio_device_alloc(dev, sizeof(*yas5xx));
de8860b1ed4701 Linus Walleij 2020-12-24  825  	if (!indio_dev)
de8860b1ed4701 Linus Walleij 2020-12-24  826  		return -ENOMEM;
de8860b1ed4701 Linus Walleij 2020-12-24  827  
de8860b1ed4701 Linus Walleij 2020-12-24  828  	yas5xx = iio_priv(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  829  	i2c_set_clientdata(i2c, indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  830  	yas5xx->dev = dev;
de8860b1ed4701 Linus Walleij 2020-12-24  831  	mutex_init(&yas5xx->lock);
de8860b1ed4701 Linus Walleij 2020-12-24  832  
de8860b1ed4701 Linus Walleij 2020-12-24  833  	ret = iio_read_mount_matrix(dev, "mount-matrix", &yas5xx->orientation);
de8860b1ed4701 Linus Walleij 2020-12-24  834  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  835  		return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  836  
de8860b1ed4701 Linus Walleij 2020-12-24  837  	yas5xx->regs[0].supply = "vdd";
de8860b1ed4701 Linus Walleij 2020-12-24  838  	yas5xx->regs[1].supply = "iovdd";
de8860b1ed4701 Linus Walleij 2020-12-24  839  	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(yas5xx->regs),
de8860b1ed4701 Linus Walleij 2020-12-24  840  				      yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  841  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  842  		return dev_err_probe(dev, ret, "cannot get regulators\n");
de8860b1ed4701 Linus Walleij 2020-12-24  843  
de8860b1ed4701 Linus Walleij 2020-12-24  844  	ret = regulator_bulk_enable(ARRAY_SIZE(yas5xx->regs), yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  845  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  846  		dev_err(dev, "cannot enable regulators\n");
de8860b1ed4701 Linus Walleij 2020-12-24  847  		return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  848  	}
de8860b1ed4701 Linus Walleij 2020-12-24  849  
de8860b1ed4701 Linus Walleij 2020-12-24  850  	/* See comment in runtime resume callback */
de8860b1ed4701 Linus Walleij 2020-12-24  851  	usleep_range(31000, 40000);
de8860b1ed4701 Linus Walleij 2020-12-24  852  
de8860b1ed4701 Linus Walleij 2020-12-24  853  	/* This will take the device out of reset if need be */
de8860b1ed4701 Linus Walleij 2020-12-24  854  	yas5xx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
de8860b1ed4701 Linus Walleij 2020-12-24  855  	if (IS_ERR(yas5xx->reset)) {
de8860b1ed4701 Linus Walleij 2020-12-24  856  		ret = dev_err_probe(dev, PTR_ERR(yas5xx->reset),
de8860b1ed4701 Linus Walleij 2020-12-24  857  				    "failed to get reset line\n");
de8860b1ed4701 Linus Walleij 2020-12-24  858  		goto reg_off;
de8860b1ed4701 Linus Walleij 2020-12-24  859  	}
de8860b1ed4701 Linus Walleij 2020-12-24  860  
de8860b1ed4701 Linus Walleij 2020-12-24  861  	yas5xx->map = devm_regmap_init_i2c(i2c, &yas5xx_regmap_config);
de8860b1ed4701 Linus Walleij 2020-12-24  862  	if (IS_ERR(yas5xx->map)) {
de8860b1ed4701 Linus Walleij 2020-12-24  863  		dev_err(dev, "failed to allocate register map\n");
de8860b1ed4701 Linus Walleij 2020-12-24  864  		ret = PTR_ERR(yas5xx->map);
de8860b1ed4701 Linus Walleij 2020-12-24  865  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  866  	}
de8860b1ed4701 Linus Walleij 2020-12-24  867  
de8860b1ed4701 Linus Walleij 2020-12-24  868  	ret = regmap_read(yas5xx->map, YAS5XX_DEVICE_ID, &yas5xx->devid);
de8860b1ed4701 Linus Walleij 2020-12-24  869  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  870  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  871  
de8860b1ed4701 Linus Walleij 2020-12-24  872  	switch (yas5xx->devid) {
de8860b1ed4701 Linus Walleij 2020-12-24  873  	case YAS530_DEVICE_ID:
de8860b1ed4701 Linus Walleij 2020-12-24  874  		ret = yas530_get_calibration_data(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  875  		if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  876  			goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  877  		dev_info(dev, "detected YAS530 MS-3E %s",
de8860b1ed4701 Linus Walleij 2020-12-24  878  			 yas5xx->version ? "B" : "A");
de8860b1ed4701 Linus Walleij 2020-12-24  879  		strncpy(yas5xx->name, "yas530", sizeof(yas5xx->name));
de8860b1ed4701 Linus Walleij 2020-12-24  880  		break;
de8860b1ed4701 Linus Walleij 2020-12-24  881  	case YAS532_DEVICE_ID:
de8860b1ed4701 Linus Walleij 2020-12-24  882  		ret = yas532_get_calibration_data(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  883  		if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  884  			goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  885  		dev_info(dev, "detected YAS532/YAS533 MS-3R/F %s",
de8860b1ed4701 Linus Walleij 2020-12-24  886  			 yas5xx->version ? "AC" : "AB");
de8860b1ed4701 Linus Walleij 2020-12-24  887  		strncpy(yas5xx->name, "yas532", sizeof(yas5xx->name));
de8860b1ed4701 Linus Walleij 2020-12-24  888  		break;
de8860b1ed4701 Linus Walleij 2020-12-24  889  	default:
de8860b1ed4701 Linus Walleij 2020-12-24  890  		dev_err(dev, "unhandled device ID %02x\n", yas5xx->devid);
de8860b1ed4701 Linus Walleij 2020-12-24 @891  		goto assert_reset;

"ret = -EINVAL;"

de8860b1ed4701 Linus Walleij 2020-12-24  892  	}
de8860b1ed4701 Linus Walleij 2020-12-24  893  
de8860b1ed4701 Linus Walleij 2020-12-24  894  	yas5xx_dump_calibration(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  895  	ret = yas5xx_power_on(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  896  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  897  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  898  	ret = yas5xx_meaure_offsets(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  899  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  900  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  901  
de8860b1ed4701 Linus Walleij 2020-12-24  902  	indio_dev->info = &yas5xx_info;
de8860b1ed4701 Linus Walleij 2020-12-24  903  	indio_dev->available_scan_masks = yas5xx_scan_masks;
de8860b1ed4701 Linus Walleij 2020-12-24  904  	indio_dev->modes = INDIO_DIRECT_MODE;
de8860b1ed4701 Linus Walleij 2020-12-24  905  	indio_dev->name = yas5xx->name;
de8860b1ed4701 Linus Walleij 2020-12-24  906  	indio_dev->channels = yas5xx_channels;
de8860b1ed4701 Linus Walleij 2020-12-24  907  	indio_dev->num_channels = ARRAY_SIZE(yas5xx_channels);
de8860b1ed4701 Linus Walleij 2020-12-24  908  
de8860b1ed4701 Linus Walleij 2020-12-24  909  	ret = iio_triggered_buffer_setup(indio_dev, NULL,
de8860b1ed4701 Linus Walleij 2020-12-24  910  					 yas5xx_handle_trigger,
de8860b1ed4701 Linus Walleij 2020-12-24  911  					 NULL);
de8860b1ed4701 Linus Walleij 2020-12-24  912  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  913  		dev_err(dev, "triggered buffer setup failed\n");
de8860b1ed4701 Linus Walleij 2020-12-24  914  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  915  	}
de8860b1ed4701 Linus Walleij 2020-12-24  916  
de8860b1ed4701 Linus Walleij 2020-12-24  917  	ret = iio_device_register(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  918  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  919  		dev_err(dev, "device register failed\n");
de8860b1ed4701 Linus Walleij 2020-12-24  920  		goto cleanup_buffer;
de8860b1ed4701 Linus Walleij 2020-12-24  921  	}
de8860b1ed4701 Linus Walleij 2020-12-24  922  
de8860b1ed4701 Linus Walleij 2020-12-24  923  	/* Take runtime PM online */
de8860b1ed4701 Linus Walleij 2020-12-24  924  	pm_runtime_get_noresume(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  925  	pm_runtime_set_active(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  926  	pm_runtime_enable(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  927  
de8860b1ed4701 Linus Walleij 2020-12-24  928  	pm_runtime_set_autosuspend_delay(dev, YAS5XX_AUTOSUSPEND_DELAY_MS);
de8860b1ed4701 Linus Walleij 2020-12-24  929  	pm_runtime_use_autosuspend(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  930  	pm_runtime_put(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  931  
de8860b1ed4701 Linus Walleij 2020-12-24  932  	return 0;
de8860b1ed4701 Linus Walleij 2020-12-24  933  
de8860b1ed4701 Linus Walleij 2020-12-24  934  cleanup_buffer:
de8860b1ed4701 Linus Walleij 2020-12-24  935  	iio_triggered_buffer_cleanup(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  936  assert_reset:
de8860b1ed4701 Linus Walleij 2020-12-24  937  	gpiod_set_value_cansleep(yas5xx->reset, 1);
de8860b1ed4701 Linus Walleij 2020-12-24  938  reg_off:
de8860b1ed4701 Linus Walleij 2020-12-24  939  	regulator_bulk_disable(ARRAY_SIZE(yas5xx->regs), yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  940  
de8860b1ed4701 Linus Walleij 2020-12-24  941  	return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  942  }

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 31004 bytes --]

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

* [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
@ 2021-02-15 13:40 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-02-15 13:40 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 10120 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   07f7e57c63aaa2afb4ea31edef05e08699a63a00
commit: de8860b1ed4701ea7e6f760f02d79ca6a3b656a1 [2008/11103] iio: magnetometer: Add driver for Yamaha YAS530
config: x86_64-randconfig-m001-20210215 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'

vim +/ret +891 drivers/iio/magnetometer/yamaha-yas530.c

de8860b1ed4701 Linus Walleij 2020-12-24  816  static int yas5xx_probe(struct i2c_client *i2c,
de8860b1ed4701 Linus Walleij 2020-12-24  817  			const struct i2c_device_id *id)
de8860b1ed4701 Linus Walleij 2020-12-24  818  {
de8860b1ed4701 Linus Walleij 2020-12-24  819  	struct iio_dev *indio_dev;
de8860b1ed4701 Linus Walleij 2020-12-24  820  	struct device *dev = &i2c->dev;
de8860b1ed4701 Linus Walleij 2020-12-24  821  	struct yas5xx *yas5xx;
de8860b1ed4701 Linus Walleij 2020-12-24  822  	int ret;
de8860b1ed4701 Linus Walleij 2020-12-24  823  
de8860b1ed4701 Linus Walleij 2020-12-24  824  	indio_dev = devm_iio_device_alloc(dev, sizeof(*yas5xx));
de8860b1ed4701 Linus Walleij 2020-12-24  825  	if (!indio_dev)
de8860b1ed4701 Linus Walleij 2020-12-24  826  		return -ENOMEM;
de8860b1ed4701 Linus Walleij 2020-12-24  827  
de8860b1ed4701 Linus Walleij 2020-12-24  828  	yas5xx = iio_priv(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  829  	i2c_set_clientdata(i2c, indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  830  	yas5xx->dev = dev;
de8860b1ed4701 Linus Walleij 2020-12-24  831  	mutex_init(&yas5xx->lock);
de8860b1ed4701 Linus Walleij 2020-12-24  832  
de8860b1ed4701 Linus Walleij 2020-12-24  833  	ret = iio_read_mount_matrix(dev, "mount-matrix", &yas5xx->orientation);
de8860b1ed4701 Linus Walleij 2020-12-24  834  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  835  		return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  836  
de8860b1ed4701 Linus Walleij 2020-12-24  837  	yas5xx->regs[0].supply = "vdd";
de8860b1ed4701 Linus Walleij 2020-12-24  838  	yas5xx->regs[1].supply = "iovdd";
de8860b1ed4701 Linus Walleij 2020-12-24  839  	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(yas5xx->regs),
de8860b1ed4701 Linus Walleij 2020-12-24  840  				      yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  841  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  842  		return dev_err_probe(dev, ret, "cannot get regulators\n");
de8860b1ed4701 Linus Walleij 2020-12-24  843  
de8860b1ed4701 Linus Walleij 2020-12-24  844  	ret = regulator_bulk_enable(ARRAY_SIZE(yas5xx->regs), yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  845  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  846  		dev_err(dev, "cannot enable regulators\n");
de8860b1ed4701 Linus Walleij 2020-12-24  847  		return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  848  	}
de8860b1ed4701 Linus Walleij 2020-12-24  849  
de8860b1ed4701 Linus Walleij 2020-12-24  850  	/* See comment in runtime resume callback */
de8860b1ed4701 Linus Walleij 2020-12-24  851  	usleep_range(31000, 40000);
de8860b1ed4701 Linus Walleij 2020-12-24  852  
de8860b1ed4701 Linus Walleij 2020-12-24  853  	/* This will take the device out of reset if need be */
de8860b1ed4701 Linus Walleij 2020-12-24  854  	yas5xx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
de8860b1ed4701 Linus Walleij 2020-12-24  855  	if (IS_ERR(yas5xx->reset)) {
de8860b1ed4701 Linus Walleij 2020-12-24  856  		ret = dev_err_probe(dev, PTR_ERR(yas5xx->reset),
de8860b1ed4701 Linus Walleij 2020-12-24  857  				    "failed to get reset line\n");
de8860b1ed4701 Linus Walleij 2020-12-24  858  		goto reg_off;
de8860b1ed4701 Linus Walleij 2020-12-24  859  	}
de8860b1ed4701 Linus Walleij 2020-12-24  860  
de8860b1ed4701 Linus Walleij 2020-12-24  861  	yas5xx->map = devm_regmap_init_i2c(i2c, &yas5xx_regmap_config);
de8860b1ed4701 Linus Walleij 2020-12-24  862  	if (IS_ERR(yas5xx->map)) {
de8860b1ed4701 Linus Walleij 2020-12-24  863  		dev_err(dev, "failed to allocate register map\n");
de8860b1ed4701 Linus Walleij 2020-12-24  864  		ret = PTR_ERR(yas5xx->map);
de8860b1ed4701 Linus Walleij 2020-12-24  865  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  866  	}
de8860b1ed4701 Linus Walleij 2020-12-24  867  
de8860b1ed4701 Linus Walleij 2020-12-24  868  	ret = regmap_read(yas5xx->map, YAS5XX_DEVICE_ID, &yas5xx->devid);
de8860b1ed4701 Linus Walleij 2020-12-24  869  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  870  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  871  
de8860b1ed4701 Linus Walleij 2020-12-24  872  	switch (yas5xx->devid) {
de8860b1ed4701 Linus Walleij 2020-12-24  873  	case YAS530_DEVICE_ID:
de8860b1ed4701 Linus Walleij 2020-12-24  874  		ret = yas530_get_calibration_data(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  875  		if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  876  			goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  877  		dev_info(dev, "detected YAS530 MS-3E %s",
de8860b1ed4701 Linus Walleij 2020-12-24  878  			 yas5xx->version ? "B" : "A");
de8860b1ed4701 Linus Walleij 2020-12-24  879  		strncpy(yas5xx->name, "yas530", sizeof(yas5xx->name));
de8860b1ed4701 Linus Walleij 2020-12-24  880  		break;
de8860b1ed4701 Linus Walleij 2020-12-24  881  	case YAS532_DEVICE_ID:
de8860b1ed4701 Linus Walleij 2020-12-24  882  		ret = yas532_get_calibration_data(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  883  		if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  884  			goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  885  		dev_info(dev, "detected YAS532/YAS533 MS-3R/F %s",
de8860b1ed4701 Linus Walleij 2020-12-24  886  			 yas5xx->version ? "AC" : "AB");
de8860b1ed4701 Linus Walleij 2020-12-24  887  		strncpy(yas5xx->name, "yas532", sizeof(yas5xx->name));
de8860b1ed4701 Linus Walleij 2020-12-24  888  		break;
de8860b1ed4701 Linus Walleij 2020-12-24  889  	default:
de8860b1ed4701 Linus Walleij 2020-12-24  890  		dev_err(dev, "unhandled device ID %02x\n", yas5xx->devid);
de8860b1ed4701 Linus Walleij 2020-12-24 @891  		goto assert_reset;

"ret = -EINVAL;"

de8860b1ed4701 Linus Walleij 2020-12-24  892  	}
de8860b1ed4701 Linus Walleij 2020-12-24  893  
de8860b1ed4701 Linus Walleij 2020-12-24  894  	yas5xx_dump_calibration(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  895  	ret = yas5xx_power_on(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  896  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  897  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  898  	ret = yas5xx_meaure_offsets(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  899  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  900  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  901  
de8860b1ed4701 Linus Walleij 2020-12-24  902  	indio_dev->info = &yas5xx_info;
de8860b1ed4701 Linus Walleij 2020-12-24  903  	indio_dev->available_scan_masks = yas5xx_scan_masks;
de8860b1ed4701 Linus Walleij 2020-12-24  904  	indio_dev->modes = INDIO_DIRECT_MODE;
de8860b1ed4701 Linus Walleij 2020-12-24  905  	indio_dev->name = yas5xx->name;
de8860b1ed4701 Linus Walleij 2020-12-24  906  	indio_dev->channels = yas5xx_channels;
de8860b1ed4701 Linus Walleij 2020-12-24  907  	indio_dev->num_channels = ARRAY_SIZE(yas5xx_channels);
de8860b1ed4701 Linus Walleij 2020-12-24  908  
de8860b1ed4701 Linus Walleij 2020-12-24  909  	ret = iio_triggered_buffer_setup(indio_dev, NULL,
de8860b1ed4701 Linus Walleij 2020-12-24  910  					 yas5xx_handle_trigger,
de8860b1ed4701 Linus Walleij 2020-12-24  911  					 NULL);
de8860b1ed4701 Linus Walleij 2020-12-24  912  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  913  		dev_err(dev, "triggered buffer setup failed\n");
de8860b1ed4701 Linus Walleij 2020-12-24  914  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  915  	}
de8860b1ed4701 Linus Walleij 2020-12-24  916  
de8860b1ed4701 Linus Walleij 2020-12-24  917  	ret = iio_device_register(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  918  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  919  		dev_err(dev, "device register failed\n");
de8860b1ed4701 Linus Walleij 2020-12-24  920  		goto cleanup_buffer;
de8860b1ed4701 Linus Walleij 2020-12-24  921  	}
de8860b1ed4701 Linus Walleij 2020-12-24  922  
de8860b1ed4701 Linus Walleij 2020-12-24  923  	/* Take runtime PM online */
de8860b1ed4701 Linus Walleij 2020-12-24  924  	pm_runtime_get_noresume(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  925  	pm_runtime_set_active(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  926  	pm_runtime_enable(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  927  
de8860b1ed4701 Linus Walleij 2020-12-24  928  	pm_runtime_set_autosuspend_delay(dev, YAS5XX_AUTOSUSPEND_DELAY_MS);
de8860b1ed4701 Linus Walleij 2020-12-24  929  	pm_runtime_use_autosuspend(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  930  	pm_runtime_put(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  931  
de8860b1ed4701 Linus Walleij 2020-12-24  932  	return 0;
de8860b1ed4701 Linus Walleij 2020-12-24  933  
de8860b1ed4701 Linus Walleij 2020-12-24  934  cleanup_buffer:
de8860b1ed4701 Linus Walleij 2020-12-24  935  	iio_triggered_buffer_cleanup(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  936  assert_reset:
de8860b1ed4701 Linus Walleij 2020-12-24  937  	gpiod_set_value_cansleep(yas5xx->reset, 1);
de8860b1ed4701 Linus Walleij 2020-12-24  938  reg_off:
de8860b1ed4701 Linus Walleij 2020-12-24  939  	regulator_bulk_disable(ARRAY_SIZE(yas5xx->regs), yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  940  
de8860b1ed4701 Linus Walleij 2020-12-24  941  	return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  942  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31004 bytes --]

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

* [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
@ 2021-02-15 13:40 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-02-15 13:40 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 10120 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   07f7e57c63aaa2afb4ea31edef05e08699a63a00
commit: de8860b1ed4701ea7e6f760f02d79ca6a3b656a1 [2008/11103] iio: magnetometer: Add driver for Yamaha YAS530
config: x86_64-randconfig-m001-20210215 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'

vim +/ret +891 drivers/iio/magnetometer/yamaha-yas530.c

de8860b1ed4701 Linus Walleij 2020-12-24  816  static int yas5xx_probe(struct i2c_client *i2c,
de8860b1ed4701 Linus Walleij 2020-12-24  817  			const struct i2c_device_id *id)
de8860b1ed4701 Linus Walleij 2020-12-24  818  {
de8860b1ed4701 Linus Walleij 2020-12-24  819  	struct iio_dev *indio_dev;
de8860b1ed4701 Linus Walleij 2020-12-24  820  	struct device *dev = &i2c->dev;
de8860b1ed4701 Linus Walleij 2020-12-24  821  	struct yas5xx *yas5xx;
de8860b1ed4701 Linus Walleij 2020-12-24  822  	int ret;
de8860b1ed4701 Linus Walleij 2020-12-24  823  
de8860b1ed4701 Linus Walleij 2020-12-24  824  	indio_dev = devm_iio_device_alloc(dev, sizeof(*yas5xx));
de8860b1ed4701 Linus Walleij 2020-12-24  825  	if (!indio_dev)
de8860b1ed4701 Linus Walleij 2020-12-24  826  		return -ENOMEM;
de8860b1ed4701 Linus Walleij 2020-12-24  827  
de8860b1ed4701 Linus Walleij 2020-12-24  828  	yas5xx = iio_priv(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  829  	i2c_set_clientdata(i2c, indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  830  	yas5xx->dev = dev;
de8860b1ed4701 Linus Walleij 2020-12-24  831  	mutex_init(&yas5xx->lock);
de8860b1ed4701 Linus Walleij 2020-12-24  832  
de8860b1ed4701 Linus Walleij 2020-12-24  833  	ret = iio_read_mount_matrix(dev, "mount-matrix", &yas5xx->orientation);
de8860b1ed4701 Linus Walleij 2020-12-24  834  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  835  		return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  836  
de8860b1ed4701 Linus Walleij 2020-12-24  837  	yas5xx->regs[0].supply = "vdd";
de8860b1ed4701 Linus Walleij 2020-12-24  838  	yas5xx->regs[1].supply = "iovdd";
de8860b1ed4701 Linus Walleij 2020-12-24  839  	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(yas5xx->regs),
de8860b1ed4701 Linus Walleij 2020-12-24  840  				      yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  841  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  842  		return dev_err_probe(dev, ret, "cannot get regulators\n");
de8860b1ed4701 Linus Walleij 2020-12-24  843  
de8860b1ed4701 Linus Walleij 2020-12-24  844  	ret = regulator_bulk_enable(ARRAY_SIZE(yas5xx->regs), yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  845  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  846  		dev_err(dev, "cannot enable regulators\n");
de8860b1ed4701 Linus Walleij 2020-12-24  847  		return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  848  	}
de8860b1ed4701 Linus Walleij 2020-12-24  849  
de8860b1ed4701 Linus Walleij 2020-12-24  850  	/* See comment in runtime resume callback */
de8860b1ed4701 Linus Walleij 2020-12-24  851  	usleep_range(31000, 40000);
de8860b1ed4701 Linus Walleij 2020-12-24  852  
de8860b1ed4701 Linus Walleij 2020-12-24  853  	/* This will take the device out of reset if need be */
de8860b1ed4701 Linus Walleij 2020-12-24  854  	yas5xx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
de8860b1ed4701 Linus Walleij 2020-12-24  855  	if (IS_ERR(yas5xx->reset)) {
de8860b1ed4701 Linus Walleij 2020-12-24  856  		ret = dev_err_probe(dev, PTR_ERR(yas5xx->reset),
de8860b1ed4701 Linus Walleij 2020-12-24  857  				    "failed to get reset line\n");
de8860b1ed4701 Linus Walleij 2020-12-24  858  		goto reg_off;
de8860b1ed4701 Linus Walleij 2020-12-24  859  	}
de8860b1ed4701 Linus Walleij 2020-12-24  860  
de8860b1ed4701 Linus Walleij 2020-12-24  861  	yas5xx->map = devm_regmap_init_i2c(i2c, &yas5xx_regmap_config);
de8860b1ed4701 Linus Walleij 2020-12-24  862  	if (IS_ERR(yas5xx->map)) {
de8860b1ed4701 Linus Walleij 2020-12-24  863  		dev_err(dev, "failed to allocate register map\n");
de8860b1ed4701 Linus Walleij 2020-12-24  864  		ret = PTR_ERR(yas5xx->map);
de8860b1ed4701 Linus Walleij 2020-12-24  865  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  866  	}
de8860b1ed4701 Linus Walleij 2020-12-24  867  
de8860b1ed4701 Linus Walleij 2020-12-24  868  	ret = regmap_read(yas5xx->map, YAS5XX_DEVICE_ID, &yas5xx->devid);
de8860b1ed4701 Linus Walleij 2020-12-24  869  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  870  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  871  
de8860b1ed4701 Linus Walleij 2020-12-24  872  	switch (yas5xx->devid) {
de8860b1ed4701 Linus Walleij 2020-12-24  873  	case YAS530_DEVICE_ID:
de8860b1ed4701 Linus Walleij 2020-12-24  874  		ret = yas530_get_calibration_data(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  875  		if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  876  			goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  877  		dev_info(dev, "detected YAS530 MS-3E %s",
de8860b1ed4701 Linus Walleij 2020-12-24  878  			 yas5xx->version ? "B" : "A");
de8860b1ed4701 Linus Walleij 2020-12-24  879  		strncpy(yas5xx->name, "yas530", sizeof(yas5xx->name));
de8860b1ed4701 Linus Walleij 2020-12-24  880  		break;
de8860b1ed4701 Linus Walleij 2020-12-24  881  	case YAS532_DEVICE_ID:
de8860b1ed4701 Linus Walleij 2020-12-24  882  		ret = yas532_get_calibration_data(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  883  		if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  884  			goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  885  		dev_info(dev, "detected YAS532/YAS533 MS-3R/F %s",
de8860b1ed4701 Linus Walleij 2020-12-24  886  			 yas5xx->version ? "AC" : "AB");
de8860b1ed4701 Linus Walleij 2020-12-24  887  		strncpy(yas5xx->name, "yas532", sizeof(yas5xx->name));
de8860b1ed4701 Linus Walleij 2020-12-24  888  		break;
de8860b1ed4701 Linus Walleij 2020-12-24  889  	default:
de8860b1ed4701 Linus Walleij 2020-12-24  890  		dev_err(dev, "unhandled device ID %02x\n", yas5xx->devid);
de8860b1ed4701 Linus Walleij 2020-12-24 @891  		goto assert_reset;

"ret = -EINVAL;"

de8860b1ed4701 Linus Walleij 2020-12-24  892  	}
de8860b1ed4701 Linus Walleij 2020-12-24  893  
de8860b1ed4701 Linus Walleij 2020-12-24  894  	yas5xx_dump_calibration(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  895  	ret = yas5xx_power_on(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  896  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  897  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  898  	ret = yas5xx_meaure_offsets(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  899  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  900  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  901  
de8860b1ed4701 Linus Walleij 2020-12-24  902  	indio_dev->info = &yas5xx_info;
de8860b1ed4701 Linus Walleij 2020-12-24  903  	indio_dev->available_scan_masks = yas5xx_scan_masks;
de8860b1ed4701 Linus Walleij 2020-12-24  904  	indio_dev->modes = INDIO_DIRECT_MODE;
de8860b1ed4701 Linus Walleij 2020-12-24  905  	indio_dev->name = yas5xx->name;
de8860b1ed4701 Linus Walleij 2020-12-24  906  	indio_dev->channels = yas5xx_channels;
de8860b1ed4701 Linus Walleij 2020-12-24  907  	indio_dev->num_channels = ARRAY_SIZE(yas5xx_channels);
de8860b1ed4701 Linus Walleij 2020-12-24  908  
de8860b1ed4701 Linus Walleij 2020-12-24  909  	ret = iio_triggered_buffer_setup(indio_dev, NULL,
de8860b1ed4701 Linus Walleij 2020-12-24  910  					 yas5xx_handle_trigger,
de8860b1ed4701 Linus Walleij 2020-12-24  911  					 NULL);
de8860b1ed4701 Linus Walleij 2020-12-24  912  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  913  		dev_err(dev, "triggered buffer setup failed\n");
de8860b1ed4701 Linus Walleij 2020-12-24  914  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  915  	}
de8860b1ed4701 Linus Walleij 2020-12-24  916  
de8860b1ed4701 Linus Walleij 2020-12-24  917  	ret = iio_device_register(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  918  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  919  		dev_err(dev, "device register failed\n");
de8860b1ed4701 Linus Walleij 2020-12-24  920  		goto cleanup_buffer;
de8860b1ed4701 Linus Walleij 2020-12-24  921  	}
de8860b1ed4701 Linus Walleij 2020-12-24  922  
de8860b1ed4701 Linus Walleij 2020-12-24  923  	/* Take runtime PM online */
de8860b1ed4701 Linus Walleij 2020-12-24  924  	pm_runtime_get_noresume(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  925  	pm_runtime_set_active(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  926  	pm_runtime_enable(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  927  
de8860b1ed4701 Linus Walleij 2020-12-24  928  	pm_runtime_set_autosuspend_delay(dev, YAS5XX_AUTOSUSPEND_DELAY_MS);
de8860b1ed4701 Linus Walleij 2020-12-24  929  	pm_runtime_use_autosuspend(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  930  	pm_runtime_put(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  931  
de8860b1ed4701 Linus Walleij 2020-12-24  932  	return 0;
de8860b1ed4701 Linus Walleij 2020-12-24  933  
de8860b1ed4701 Linus Walleij 2020-12-24  934  cleanup_buffer:
de8860b1ed4701 Linus Walleij 2020-12-24  935  	iio_triggered_buffer_cleanup(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  936  assert_reset:
de8860b1ed4701 Linus Walleij 2020-12-24  937  	gpiod_set_value_cansleep(yas5xx->reset, 1);
de8860b1ed4701 Linus Walleij 2020-12-24  938  reg_off:
de8860b1ed4701 Linus Walleij 2020-12-24  939  	regulator_bulk_disable(ARRAY_SIZE(yas5xx->regs), yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  940  
de8860b1ed4701 Linus Walleij 2020-12-24  941  	return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  942  }

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31004 bytes --]

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

* Re: [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
  2021-02-15 13:40 ` Dan Carpenter
@ 2021-02-15 15:05   ` Andy Shevchenko
  -1 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2021-02-15 15:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: kbuild, Linus Walleij, kbuild test robot, kbuild-all,
	Linux Memory Management List, Jonathan Cameron

On Mon, Feb 15, 2021 at 3:40 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   07f7e57c63aaa2afb4ea31edef05e08699a63a00
> commit: de8860b1ed4701ea7e6f760f02d79ca6a3b656a1 [2008/11103] iio: magnetometer: Add driver for Yamaha YAS530
> config: x86_64-randconfig-m001-20210215 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> smatch warnings:
> drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'

Indeed.

> de8860b1ed4701 Linus Walleij 2020-12-24  872    switch (yas5xx->devid) {
> de8860b1ed4701 Linus Walleij 2020-12-24  873    case YAS530_DEVICE_ID:
> de8860b1ed4701 Linus Walleij 2020-12-24  874            ret = yas530_get_calibration_data(yas5xx);
> de8860b1ed4701 Linus Walleij 2020-12-24  875            if (ret)
> de8860b1ed4701 Linus Walleij 2020-12-24  876                    goto assert_reset;
> de8860b1ed4701 Linus Walleij 2020-12-24  877            dev_info(dev, "detected YAS530 MS-3E %s",
> de8860b1ed4701 Linus Walleij 2020-12-24  878                     yas5xx->version ? "B" : "A");
> de8860b1ed4701 Linus Walleij 2020-12-24  879            strncpy(yas5xx->name, "yas530", sizeof(yas5xx->name));
> de8860b1ed4701 Linus Walleij 2020-12-24  880            break;
> de8860b1ed4701 Linus Walleij 2020-12-24  881    case YAS532_DEVICE_ID:
> de8860b1ed4701 Linus Walleij 2020-12-24  882            ret = yas532_get_calibration_data(yas5xx);
> de8860b1ed4701 Linus Walleij 2020-12-24  883            if (ret)
> de8860b1ed4701 Linus Walleij 2020-12-24  884                    goto assert_reset;
> de8860b1ed4701 Linus Walleij 2020-12-24  885            dev_info(dev, "detected YAS532/YAS533 MS-3R/F %s",
> de8860b1ed4701 Linus Walleij 2020-12-24  886                     yas5xx->version ? "AC" : "AB");
> de8860b1ed4701 Linus Walleij 2020-12-24  887            strncpy(yas5xx->name, "yas532", sizeof(yas5xx->name));
> de8860b1ed4701 Linus Walleij 2020-12-24  888            break;
> de8860b1ed4701 Linus Walleij 2020-12-24  889    default:
> de8860b1ed4701 Linus Walleij 2020-12-24  890            dev_err(dev, "unhandled device ID %02x\n", yas5xx->devid);
> de8860b1ed4701 Linus Walleij 2020-12-24 @891            goto assert_reset;
>
> "ret = -EINVAL;"

I think more of -ENODEV.

> de8860b1ed4701 Linus Walleij 2020-12-24  892    }


-- 
With Best Regards,
Andy Shevchenko


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

* Re: [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
@ 2021-02-15 15:05   ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2021-02-15 15:05 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 2659 bytes --]

On Mon, Feb 15, 2021 at 3:40 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   07f7e57c63aaa2afb4ea31edef05e08699a63a00
> commit: de8860b1ed4701ea7e6f760f02d79ca6a3b656a1 [2008/11103] iio: magnetometer: Add driver for Yamaha YAS530
> config: x86_64-randconfig-m001-20210215 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> smatch warnings:
> drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'

Indeed.

> de8860b1ed4701 Linus Walleij 2020-12-24  872    switch (yas5xx->devid) {
> de8860b1ed4701 Linus Walleij 2020-12-24  873    case YAS530_DEVICE_ID:
> de8860b1ed4701 Linus Walleij 2020-12-24  874            ret = yas530_get_calibration_data(yas5xx);
> de8860b1ed4701 Linus Walleij 2020-12-24  875            if (ret)
> de8860b1ed4701 Linus Walleij 2020-12-24  876                    goto assert_reset;
> de8860b1ed4701 Linus Walleij 2020-12-24  877            dev_info(dev, "detected YAS530 MS-3E %s",
> de8860b1ed4701 Linus Walleij 2020-12-24  878                     yas5xx->version ? "B" : "A");
> de8860b1ed4701 Linus Walleij 2020-12-24  879            strncpy(yas5xx->name, "yas530", sizeof(yas5xx->name));
> de8860b1ed4701 Linus Walleij 2020-12-24  880            break;
> de8860b1ed4701 Linus Walleij 2020-12-24  881    case YAS532_DEVICE_ID:
> de8860b1ed4701 Linus Walleij 2020-12-24  882            ret = yas532_get_calibration_data(yas5xx);
> de8860b1ed4701 Linus Walleij 2020-12-24  883            if (ret)
> de8860b1ed4701 Linus Walleij 2020-12-24  884                    goto assert_reset;
> de8860b1ed4701 Linus Walleij 2020-12-24  885            dev_info(dev, "detected YAS532/YAS533 MS-3R/F %s",
> de8860b1ed4701 Linus Walleij 2020-12-24  886                     yas5xx->version ? "AC" : "AB");
> de8860b1ed4701 Linus Walleij 2020-12-24  887            strncpy(yas5xx->name, "yas532", sizeof(yas5xx->name));
> de8860b1ed4701 Linus Walleij 2020-12-24  888            break;
> de8860b1ed4701 Linus Walleij 2020-12-24  889    default:
> de8860b1ed4701 Linus Walleij 2020-12-24  890            dev_err(dev, "unhandled device ID %02x\n", yas5xx->devid);
> de8860b1ed4701 Linus Walleij 2020-12-24 @891            goto assert_reset;
>
> "ret = -EINVAL;"

I think more of -ENODEV.

> de8860b1ed4701 Linus Walleij 2020-12-24  892    }


-- 
With Best Regards,
Andy Shevchenko

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

* [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
@ 2021-02-15  0:01 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2021-02-15  0:01 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 10494 bytes --]

CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Linus Walleij <linus.walleij@linaro.org>
CC: Jonathan Cameron <Jonathan.Cameron@huawei.com>
CC: Andy Shevchenko <andy.shevchenko@gmail.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   07f7e57c63aaa2afb4ea31edef05e08699a63a00
commit: de8860b1ed4701ea7e6f760f02d79ca6a3b656a1 [2008/11103] iio: magnetometer: Add driver for Yamaha YAS530
:::::: branch date: 3 days ago
:::::: commit date: 5 weeks ago
config: x86_64-randconfig-m001-20210215 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'

vim +/ret +891 drivers/iio/magnetometer/yamaha-yas530.c

de8860b1ed4701 Linus Walleij 2020-12-24  815  
de8860b1ed4701 Linus Walleij 2020-12-24  816  static int yas5xx_probe(struct i2c_client *i2c,
de8860b1ed4701 Linus Walleij 2020-12-24  817  			const struct i2c_device_id *id)
de8860b1ed4701 Linus Walleij 2020-12-24  818  {
de8860b1ed4701 Linus Walleij 2020-12-24  819  	struct iio_dev *indio_dev;
de8860b1ed4701 Linus Walleij 2020-12-24  820  	struct device *dev = &i2c->dev;
de8860b1ed4701 Linus Walleij 2020-12-24  821  	struct yas5xx *yas5xx;
de8860b1ed4701 Linus Walleij 2020-12-24  822  	int ret;
de8860b1ed4701 Linus Walleij 2020-12-24  823  
de8860b1ed4701 Linus Walleij 2020-12-24  824  	indio_dev = devm_iio_device_alloc(dev, sizeof(*yas5xx));
de8860b1ed4701 Linus Walleij 2020-12-24  825  	if (!indio_dev)
de8860b1ed4701 Linus Walleij 2020-12-24  826  		return -ENOMEM;
de8860b1ed4701 Linus Walleij 2020-12-24  827  
de8860b1ed4701 Linus Walleij 2020-12-24  828  	yas5xx = iio_priv(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  829  	i2c_set_clientdata(i2c, indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  830  	yas5xx->dev = dev;
de8860b1ed4701 Linus Walleij 2020-12-24  831  	mutex_init(&yas5xx->lock);
de8860b1ed4701 Linus Walleij 2020-12-24  832  
de8860b1ed4701 Linus Walleij 2020-12-24  833  	ret = iio_read_mount_matrix(dev, "mount-matrix", &yas5xx->orientation);
de8860b1ed4701 Linus Walleij 2020-12-24  834  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  835  		return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  836  
de8860b1ed4701 Linus Walleij 2020-12-24  837  	yas5xx->regs[0].supply = "vdd";
de8860b1ed4701 Linus Walleij 2020-12-24  838  	yas5xx->regs[1].supply = "iovdd";
de8860b1ed4701 Linus Walleij 2020-12-24  839  	ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(yas5xx->regs),
de8860b1ed4701 Linus Walleij 2020-12-24  840  				      yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  841  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  842  		return dev_err_probe(dev, ret, "cannot get regulators\n");
de8860b1ed4701 Linus Walleij 2020-12-24  843  
de8860b1ed4701 Linus Walleij 2020-12-24  844  	ret = regulator_bulk_enable(ARRAY_SIZE(yas5xx->regs), yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  845  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  846  		dev_err(dev, "cannot enable regulators\n");
de8860b1ed4701 Linus Walleij 2020-12-24  847  		return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  848  	}
de8860b1ed4701 Linus Walleij 2020-12-24  849  
de8860b1ed4701 Linus Walleij 2020-12-24  850  	/* See comment in runtime resume callback */
de8860b1ed4701 Linus Walleij 2020-12-24  851  	usleep_range(31000, 40000);
de8860b1ed4701 Linus Walleij 2020-12-24  852  
de8860b1ed4701 Linus Walleij 2020-12-24  853  	/* This will take the device out of reset if need be */
de8860b1ed4701 Linus Walleij 2020-12-24  854  	yas5xx->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
de8860b1ed4701 Linus Walleij 2020-12-24  855  	if (IS_ERR(yas5xx->reset)) {
de8860b1ed4701 Linus Walleij 2020-12-24  856  		ret = dev_err_probe(dev, PTR_ERR(yas5xx->reset),
de8860b1ed4701 Linus Walleij 2020-12-24  857  				    "failed to get reset line\n");
de8860b1ed4701 Linus Walleij 2020-12-24  858  		goto reg_off;
de8860b1ed4701 Linus Walleij 2020-12-24  859  	}
de8860b1ed4701 Linus Walleij 2020-12-24  860  
de8860b1ed4701 Linus Walleij 2020-12-24  861  	yas5xx->map = devm_regmap_init_i2c(i2c, &yas5xx_regmap_config);
de8860b1ed4701 Linus Walleij 2020-12-24  862  	if (IS_ERR(yas5xx->map)) {
de8860b1ed4701 Linus Walleij 2020-12-24  863  		dev_err(dev, "failed to allocate register map\n");
de8860b1ed4701 Linus Walleij 2020-12-24  864  		ret = PTR_ERR(yas5xx->map);
de8860b1ed4701 Linus Walleij 2020-12-24  865  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  866  	}
de8860b1ed4701 Linus Walleij 2020-12-24  867  
de8860b1ed4701 Linus Walleij 2020-12-24  868  	ret = regmap_read(yas5xx->map, YAS5XX_DEVICE_ID, &yas5xx->devid);
de8860b1ed4701 Linus Walleij 2020-12-24  869  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  870  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  871  
de8860b1ed4701 Linus Walleij 2020-12-24  872  	switch (yas5xx->devid) {
de8860b1ed4701 Linus Walleij 2020-12-24  873  	case YAS530_DEVICE_ID:
de8860b1ed4701 Linus Walleij 2020-12-24  874  		ret = yas530_get_calibration_data(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  875  		if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  876  			goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  877  		dev_info(dev, "detected YAS530 MS-3E %s",
de8860b1ed4701 Linus Walleij 2020-12-24  878  			 yas5xx->version ? "B" : "A");
de8860b1ed4701 Linus Walleij 2020-12-24  879  		strncpy(yas5xx->name, "yas530", sizeof(yas5xx->name));
de8860b1ed4701 Linus Walleij 2020-12-24  880  		break;
de8860b1ed4701 Linus Walleij 2020-12-24  881  	case YAS532_DEVICE_ID:
de8860b1ed4701 Linus Walleij 2020-12-24  882  		ret = yas532_get_calibration_data(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  883  		if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  884  			goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  885  		dev_info(dev, "detected YAS532/YAS533 MS-3R/F %s",
de8860b1ed4701 Linus Walleij 2020-12-24  886  			 yas5xx->version ? "AC" : "AB");
de8860b1ed4701 Linus Walleij 2020-12-24  887  		strncpy(yas5xx->name, "yas532", sizeof(yas5xx->name));
de8860b1ed4701 Linus Walleij 2020-12-24  888  		break;
de8860b1ed4701 Linus Walleij 2020-12-24  889  	default:
de8860b1ed4701 Linus Walleij 2020-12-24  890  		dev_err(dev, "unhandled device ID %02x\n", yas5xx->devid);
de8860b1ed4701 Linus Walleij 2020-12-24 @891  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  892  	}
de8860b1ed4701 Linus Walleij 2020-12-24  893  
de8860b1ed4701 Linus Walleij 2020-12-24  894  	yas5xx_dump_calibration(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  895  	ret = yas5xx_power_on(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  896  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  897  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  898  	ret = yas5xx_meaure_offsets(yas5xx);
de8860b1ed4701 Linus Walleij 2020-12-24  899  	if (ret)
de8860b1ed4701 Linus Walleij 2020-12-24  900  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  901  
de8860b1ed4701 Linus Walleij 2020-12-24  902  	indio_dev->info = &yas5xx_info;
de8860b1ed4701 Linus Walleij 2020-12-24  903  	indio_dev->available_scan_masks = yas5xx_scan_masks;
de8860b1ed4701 Linus Walleij 2020-12-24  904  	indio_dev->modes = INDIO_DIRECT_MODE;
de8860b1ed4701 Linus Walleij 2020-12-24  905  	indio_dev->name = yas5xx->name;
de8860b1ed4701 Linus Walleij 2020-12-24  906  	indio_dev->channels = yas5xx_channels;
de8860b1ed4701 Linus Walleij 2020-12-24  907  	indio_dev->num_channels = ARRAY_SIZE(yas5xx_channels);
de8860b1ed4701 Linus Walleij 2020-12-24  908  
de8860b1ed4701 Linus Walleij 2020-12-24  909  	ret = iio_triggered_buffer_setup(indio_dev, NULL,
de8860b1ed4701 Linus Walleij 2020-12-24  910  					 yas5xx_handle_trigger,
de8860b1ed4701 Linus Walleij 2020-12-24  911  					 NULL);
de8860b1ed4701 Linus Walleij 2020-12-24  912  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  913  		dev_err(dev, "triggered buffer setup failed\n");
de8860b1ed4701 Linus Walleij 2020-12-24  914  		goto assert_reset;
de8860b1ed4701 Linus Walleij 2020-12-24  915  	}
de8860b1ed4701 Linus Walleij 2020-12-24  916  
de8860b1ed4701 Linus Walleij 2020-12-24  917  	ret = iio_device_register(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  918  	if (ret) {
de8860b1ed4701 Linus Walleij 2020-12-24  919  		dev_err(dev, "device register failed\n");
de8860b1ed4701 Linus Walleij 2020-12-24  920  		goto cleanup_buffer;
de8860b1ed4701 Linus Walleij 2020-12-24  921  	}
de8860b1ed4701 Linus Walleij 2020-12-24  922  
de8860b1ed4701 Linus Walleij 2020-12-24  923  	/* Take runtime PM online */
de8860b1ed4701 Linus Walleij 2020-12-24  924  	pm_runtime_get_noresume(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  925  	pm_runtime_set_active(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  926  	pm_runtime_enable(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  927  
de8860b1ed4701 Linus Walleij 2020-12-24  928  	pm_runtime_set_autosuspend_delay(dev, YAS5XX_AUTOSUSPEND_DELAY_MS);
de8860b1ed4701 Linus Walleij 2020-12-24  929  	pm_runtime_use_autosuspend(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  930  	pm_runtime_put(dev);
de8860b1ed4701 Linus Walleij 2020-12-24  931  
de8860b1ed4701 Linus Walleij 2020-12-24  932  	return 0;
de8860b1ed4701 Linus Walleij 2020-12-24  933  
de8860b1ed4701 Linus Walleij 2020-12-24  934  cleanup_buffer:
de8860b1ed4701 Linus Walleij 2020-12-24  935  	iio_triggered_buffer_cleanup(indio_dev);
de8860b1ed4701 Linus Walleij 2020-12-24  936  assert_reset:
de8860b1ed4701 Linus Walleij 2020-12-24  937  	gpiod_set_value_cansleep(yas5xx->reset, 1);
de8860b1ed4701 Linus Walleij 2020-12-24  938  reg_off:
de8860b1ed4701 Linus Walleij 2020-12-24  939  	regulator_bulk_disable(ARRAY_SIZE(yas5xx->regs), yas5xx->regs);
de8860b1ed4701 Linus Walleij 2020-12-24  940  
de8860b1ed4701 Linus Walleij 2020-12-24  941  	return ret;
de8860b1ed4701 Linus Walleij 2020-12-24  942  }
de8860b1ed4701 Linus Walleij 2020-12-24  943  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 31004 bytes --]

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

end of thread, other threads:[~2021-02-15 15:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-15 13:40 [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret' Dan Carpenter
2021-02-15 13:40 ` Dan Carpenter
2021-02-15 13:40 ` Dan Carpenter
2021-02-15 15:05 ` Andy Shevchenko
2021-02-15 15:05   ` Andy Shevchenko
  -- strict thread matches above, loose matches on Subject: below --
2021-02-15  0:01 kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.