All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
Date: Mon, 15 Feb 2021 16:40:15 +0300	[thread overview]
Message-ID: <20210215134015.GR2087@kadam> (raw)

[-- 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 --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
Date: Mon, 15 Feb 2021 16:40:15 +0300	[thread overview]
Message-ID: <20210215134015.GR2087@kadam> (raw)

[-- 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 --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Linus Walleij <linus.walleij@linaro.org>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Subject: [linux-next:master 2008/11103] drivers/iio/magnetometer/yamaha-yas530.c:891 yas5xx_probe() warn: missing error code 'ret'
Date: Mon, 15 Feb 2021 16:40:15 +0300	[thread overview]
Message-ID: <20210215134015.GR2087@kadam> (raw)

[-- 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 --]

             reply	other threads:[~2021-02-15 13:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 13:40 Dan Carpenter [this message]
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 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210215134015.GR2087@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.