All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 4/4] i2c-mux-pca954x: Add regulator support
@ 2021-12-14 18:46 kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-12-14 18:46 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211214095021.572799-4-patrick.rudolph@9elements.com>
References: <20211214095021.572799-4-patrick.rudolph@9elements.com>
TO: Patrick Rudolph <patrick.rudolph@9elements.com>
TO: Peter Rosin <peda@axentia.se>
CC: Patrick Rudolph <patrick.rudolph@9elements.com>
CC: linux-i2c(a)vger.kernel.org
CC: linux-kernel(a)vger.kernel.org

Hi Patrick,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on robh/for-next linux/master linus/master v5.16-rc5 next-20211213]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Patrick-Rudolph/dt-bindings-i2c-Update-PCA954x/20211214-175258
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: i386-randconfig-m021-20211214 (https://download.01.org/0day-ci/archive/20211215/202112150247.RE72OaYJ-lkp(a)intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 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/i2c/muxes/i2c-mux-pca954x.c:502 pca954x_probe() error: uninitialized symbol 'ret'.

vim +/ret +502 drivers/i2c/muxes/i2c-mux-pca954x.c

e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  470  
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  471  /*
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  472   * I2C init/probing/exit functions
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  473   */
db79f2a1d259a9 drivers/i2c/muxes/pca954x.c         Guenter Roeck    2010-10-24  474  static int pca954x_probe(struct i2c_client *client,
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  475  			 const struct i2c_device_id *id)
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  476  {
f2e0821377a37a drivers/i2c/muxes/i2c-mux-pca954x.c Luca Ceresoli    2018-10-03  477  	struct i2c_adapter *adap = client->adapter;
6856909ce542dd drivers/i2c/muxes/i2c-mux-pca954x.c Linus Walleij    2018-06-05  478  	struct device *dev = &client->dev;
4807e8459bce42 drivers/i2c/muxes/i2c-mux-pca954x.c Laurent Pinchart 2014-06-03  479  	struct gpio_desc *gpio;
7fcac980717532 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2016-04-20  480  	struct i2c_mux_core *muxc;
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  481  	struct pca954x *data;
ddd7c492d419ea drivers/i2c/muxes/i2c-mux-pca954x.c Robert Shearman  2019-02-28  482  	int num;
bc12cfc87f1028 drivers/i2c/muxes/i2c-mux-pca954x.c Laurent Pinchart 2013-11-29  483  	int ret;
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  484  
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  485  	if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE))
bc12cfc87f1028 drivers/i2c/muxes/i2c-mux-pca954x.c Laurent Pinchart 2013-11-29  486  		return -ENODEV;
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  487  
6856909ce542dd drivers/i2c/muxes/i2c-mux-pca954x.c Linus Walleij    2018-06-05  488  	muxc = i2c_mux_alloc(adap, dev, PCA954X_MAX_NCHANS, sizeof(*data), 0,
7fcac980717532 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2016-04-20  489  			     pca954x_select_chan, pca954x_deselect_mux);
7fcac980717532 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2016-04-20  490  	if (!muxc)
bc12cfc87f1028 drivers/i2c/muxes/i2c-mux-pca954x.c Laurent Pinchart 2013-11-29  491  		return -ENOMEM;
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  492  
7fcac980717532 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2016-04-20  493  	data = i2c_mux_priv(muxc);
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  494  
7fcac980717532 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2016-04-20  495  	i2c_set_clientdata(client, muxc);
7fcac980717532 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2016-04-20  496  	data->client = client;
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  497  
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  498  	data->supply = devm_regulator_get(dev, "vcc");
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  499  	if (IS_ERR(data->supply)) {
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  500  		if ((PTR_ERR(data->supply) == -EPROBE_DEFER))
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  501  			return -EPROBE_DEFER;
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14 @502  		dev_warn(dev, "Failed to get regulator for vcc: %d\n", ret);
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  503  	} else {
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  504  		ret = regulator_enable(data->supply);
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  505  		if (ret) {
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  506  			dev_err(dev, "Failed to enable regulator vcc\n");
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  507  			return ret;
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  508  		}
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  509  	}
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  510  
a2f8445d4ca279 drivers/i2c/muxes/i2c-mux-pca954x.c Mike Looijmans   2018-05-01  511  	/* Reset the mux if a reset GPIO is specified. */
6856909ce542dd drivers/i2c/muxes/i2c-mux-pca954x.c Linus Walleij    2018-06-05  512  	gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  513  	if (IS_ERR(gpio)) {
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  514  		ret = PTR_ERR(gpio);
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  515  		goto fail_cleanup;
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  516  	}
a2f8445d4ca279 drivers/i2c/muxes/i2c-mux-pca954x.c Mike Looijmans   2018-05-01  517  	if (gpio) {
a2f8445d4ca279 drivers/i2c/muxes/i2c-mux-pca954x.c Mike Looijmans   2018-05-01  518  		udelay(1);
a2f8445d4ca279 drivers/i2c/muxes/i2c-mux-pca954x.c Mike Looijmans   2018-05-01  519  		gpiod_set_value_cansleep(gpio, 0);
a2f8445d4ca279 drivers/i2c/muxes/i2c-mux-pca954x.c Mike Looijmans   2018-05-01  520  		/* Give the chip some time to recover. */
a2f8445d4ca279 drivers/i2c/muxes/i2c-mux-pca954x.c Mike Looijmans   2018-05-01  521  		udelay(1);
a2f8445d4ca279 drivers/i2c/muxes/i2c-mux-pca954x.c Mike Looijmans   2018-05-01  522  	}
12097957a9ed13 drivers/i2c/muxes/i2c-mux-pca954x.c Laurent Pinchart 2013-11-29  523  
753aa3694382c5 drivers/i2c/muxes/i2c-mux-pca954x.c Andy Shevchenko  2020-04-25  524  	data->chip = device_get_match_data(dev);
b10d7a1fd6fcb1 drivers/i2c/muxes/i2c-mux-pca954x.c Julia Lawall     2018-05-21  525  	if (!data->chip)
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  526  		data->chip = &chips[id->driver_data];
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  527  
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  528  	if (data->chip->id.manufacturer_id != I2C_DEVICE_ID_NONE) {
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  529  		struct i2c_device_identity id;
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  530  
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  531  		ret = i2c_get_device_id(client, &id);
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  532  		if (ret && ret != -EOPNOTSUPP)
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  533  			goto fail_cleanup;
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  534  
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  535  		if (!ret &&
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  536  		    (id.manufacturer_id != data->chip->id.manufacturer_id ||
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  537  		     id.part_id != data->chip->id.part_id)) {
6856909ce542dd drivers/i2c/muxes/i2c-mux-pca954x.c Linus Walleij    2018-06-05  538  			dev_warn(dev, "unexpected device id %03x-%03x-%x\n",
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  539  				 id.manufacturer_id, id.part_id,
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  540  				 id.die_revision);
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  541  			ret = -ENODEV;
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  542  			goto fail_cleanup;
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  543  		}
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  544  	}
2d74187d5b4e29 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2018-01-22  545  
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  546  	data->idle_state = MUX_IDLE_AS_IS;
753aa3694382c5 drivers/i2c/muxes/i2c-mux-pca954x.c Andy Shevchenko  2020-04-25  547  	if (device_property_read_u32(dev, "idle-state", &data->idle_state)) {
753aa3694382c5 drivers/i2c/muxes/i2c-mux-pca954x.c Andy Shevchenko  2020-04-25  548  		if (device_property_read_bool(dev, "i2c-mux-idle-disconnect"))
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  549  			data->idle_state = MUX_IDLE_DISCONNECT;
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  550  	}
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  551  
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  552  	/*
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  553  	 * Write the mux register at addr to verify
cd823db8b1161e drivers/i2c/muxes/pca954x.c         Petri Gynther    2011-06-29  554  	 * that the mux is in fact present. This also
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  555  	 * initializes the mux to a channel
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  556  	 * or disconnected state.
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  557  	 */
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  558  	ret = pca954x_init(client, data);
e65e228eb0963b drivers/i2c/muxes/i2c-mux-pca954x.c Biwen Li         2019-12-25  559  	if (ret < 0) {
6856909ce542dd drivers/i2c/muxes/i2c-mux-pca954x.c Linus Walleij    2018-06-05  560  		dev_warn(dev, "probe failed\n");
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  561  		ret = -ENODEV;
3498c52eb6aec0 drivers/i2c/muxes/i2c-mux-pca954x.c Patrick Rudolph  2021-12-14  562  		goto fail_cleanup;
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  563  	}
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  564  
f2114795f721bd drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-01-25  565  	ret = pca954x_irq_setup(muxc);
f2114795f721bd drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-01-25  566  	if (ret)
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  567  		goto fail_cleanup;
f2114795f721bd drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-01-25  568  
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  569  	/* Now create an adapter for each channel */
8a191a7ad4ca90 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2016-07-09  570  	for (num = 0; num < data->chip->nchans; num++) {
ddd7c492d419ea drivers/i2c/muxes/i2c-mux-pca954x.c Robert Shearman  2019-02-28  571  		ret = i2c_mux_add_adapter(muxc, 0, num, 0);
0756ac32357340 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2017-04-03  572  		if (ret)
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  573  			goto fail_cleanup;
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  574  	}
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  575  
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  576  	if (data->irq) {
6856909ce542dd drivers/i2c/muxes/i2c-mux-pca954x.c Linus Walleij    2018-06-05  577  		ret = devm_request_threaded_irq(dev, data->client->irq,
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  578  						NULL, pca954x_irq_handler,
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  579  						IRQF_ONESHOT | IRQF_SHARED,
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  580  						"pca954x", data);
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  581  		if (ret)
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  582  			goto fail_cleanup;
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  583  	}
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  584  
f1fb64b04bf414 drivers/i2c/muxes/i2c-mux-pca954x.c Robert Shearman  2019-02-28  585  	/*
f1fb64b04bf414 drivers/i2c/muxes/i2c-mux-pca954x.c Robert Shearman  2019-02-28  586  	 * The attr probably isn't going to be needed in most cases,
f1fb64b04bf414 drivers/i2c/muxes/i2c-mux-pca954x.c Robert Shearman  2019-02-28  587  	 * so don't fail completely on error.
f1fb64b04bf414 drivers/i2c/muxes/i2c-mux-pca954x.c Robert Shearman  2019-02-28  588  	 */
f1fb64b04bf414 drivers/i2c/muxes/i2c-mux-pca954x.c Robert Shearman  2019-02-28  589  	device_create_file(dev, &dev_attr_idle_state);
f1fb64b04bf414 drivers/i2c/muxes/i2c-mux-pca954x.c Robert Shearman  2019-02-28  590  
6856909ce542dd drivers/i2c/muxes/i2c-mux-pca954x.c Linus Walleij    2018-06-05  591  	dev_info(dev, "registered %d multiplexed busses for I2C %s %s\n",
8a191a7ad4ca90 drivers/i2c/muxes/i2c-mux-pca954x.c Peter Rosin      2016-07-09  592  		 num, data->chip->muxtype == pca954x_ismux
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  593  				? "mux" : "switch", client->name);
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  594  
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  595  	return 0;
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  596  
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  597  fail_cleanup:
148baf1ddfb650 drivers/i2c/muxes/i2c-mux-pca954x.c Phil Reid        2017-08-24  598  	pca954x_cleanup(muxc);
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  599  	return ret;
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  600  }
7f528135da9704 drivers/i2c/muxes/pca954x.c         Michael Lawnick  2010-08-11  601  

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

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

* Re: [PATCH 4/4] i2c-mux-pca954x: Add regulator support
  2021-12-14  9:50 ` [PATCH 4/4] i2c-mux-pca954x: Add regulator support Patrick Rudolph
@ 2021-12-14 13:12     ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-12-14 13:12 UTC (permalink / raw)
  To: Patrick Rudolph, Peter Rosin
  Cc: llvm, kbuild-all, Patrick Rudolph, linux-i2c, linux-kernel

Hi Patrick,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on robh/for-next linux/master linus/master v5.16-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Patrick-Rudolph/dt-bindings-i2c-Update-PCA954x/20211214-175258
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: riscv-randconfig-r042-20211214 (https://download.01.org/0day-ci/archive/20211214/202112142101.s4i5cHhd-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/3498c52eb6aec09c78a3f07cdcb042897960f8ef
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Patrick-Rudolph/dt-bindings-i2c-Update-PCA954x/20211214-175258
        git checkout 3498c52eb6aec09c78a3f07cdcb042897960f8ef
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/i2c/muxes/

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

All warnings (new ones prefixed by >>):

>> drivers/i2c/muxes/i2c-mux-pca954x.c:502:58: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
                   dev_warn(dev, "Failed to get regulator for vcc: %d\n", ret);
                                                                          ^~~
   include/linux/dev_printk.h:146:70: note: expanded from macro 'dev_warn'
           dev_printk_index_wrap(_dev_warn, KERN_WARNING, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                               ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                   _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                       ^~~~~~~~~~~
   drivers/i2c/muxes/i2c-mux-pca954x.c:483:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +/ret +502 drivers/i2c/muxes/i2c-mux-pca954x.c

   470	
   471	/*
   472	 * I2C init/probing/exit functions
   473	 */
   474	static int pca954x_probe(struct i2c_client *client,
   475				 const struct i2c_device_id *id)
   476	{
   477		struct i2c_adapter *adap = client->adapter;
   478		struct device *dev = &client->dev;
   479		struct gpio_desc *gpio;
   480		struct i2c_mux_core *muxc;
   481		struct pca954x *data;
   482		int num;
   483		int ret;
   484	
   485		if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE))
   486			return -ENODEV;
   487	
   488		muxc = i2c_mux_alloc(adap, dev, PCA954X_MAX_NCHANS, sizeof(*data), 0,
   489				     pca954x_select_chan, pca954x_deselect_mux);
   490		if (!muxc)
   491			return -ENOMEM;
   492	
   493		data = i2c_mux_priv(muxc);
   494	
   495		i2c_set_clientdata(client, muxc);
   496		data->client = client;
   497	
   498		data->supply = devm_regulator_get(dev, "vcc");
   499		if (IS_ERR(data->supply)) {
   500			if ((PTR_ERR(data->supply) == -EPROBE_DEFER))
   501				return -EPROBE_DEFER;
 > 502			dev_warn(dev, "Failed to get regulator for vcc: %d\n", ret);
   503		} else {
   504			ret = regulator_enable(data->supply);
   505			if (ret) {
   506				dev_err(dev, "Failed to enable regulator vcc\n");
   507				return ret;
   508			}
   509		}
   510	
   511		/* Reset the mux if a reset GPIO is specified. */
   512		gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
   513		if (IS_ERR(gpio)) {
   514			ret = PTR_ERR(gpio);
   515			goto fail_cleanup;
   516		}
   517		if (gpio) {
   518			udelay(1);
   519			gpiod_set_value_cansleep(gpio, 0);
   520			/* Give the chip some time to recover. */
   521			udelay(1);
   522		}
   523	
   524		data->chip = device_get_match_data(dev);
   525		if (!data->chip)
   526			data->chip = &chips[id->driver_data];
   527	
   528		if (data->chip->id.manufacturer_id != I2C_DEVICE_ID_NONE) {
   529			struct i2c_device_identity id;
   530	
   531			ret = i2c_get_device_id(client, &id);
   532			if (ret && ret != -EOPNOTSUPP)
   533				goto fail_cleanup;
   534	
   535			if (!ret &&
   536			    (id.manufacturer_id != data->chip->id.manufacturer_id ||
   537			     id.part_id != data->chip->id.part_id)) {
   538				dev_warn(dev, "unexpected device id %03x-%03x-%x\n",
   539					 id.manufacturer_id, id.part_id,
   540					 id.die_revision);
   541				ret = -ENODEV;
   542				goto fail_cleanup;
   543			}
   544		}
   545	
   546		data->idle_state = MUX_IDLE_AS_IS;
   547		if (device_property_read_u32(dev, "idle-state", &data->idle_state)) {
   548			if (device_property_read_bool(dev, "i2c-mux-idle-disconnect"))
   549				data->idle_state = MUX_IDLE_DISCONNECT;
   550		}
   551	
   552		/*
   553		 * Write the mux register at addr to verify
   554		 * that the mux is in fact present. This also
   555		 * initializes the mux to a channel
   556		 * or disconnected state.
   557		 */
   558		ret = pca954x_init(client, data);
   559		if (ret < 0) {
   560			dev_warn(dev, "probe failed\n");
   561			ret = -ENODEV;
   562			goto fail_cleanup;
   563		}
   564	
   565		ret = pca954x_irq_setup(muxc);
   566		if (ret)
   567			goto fail_cleanup;
   568	
   569		/* Now create an adapter for each channel */
   570		for (num = 0; num < data->chip->nchans; num++) {
   571			ret = i2c_mux_add_adapter(muxc, 0, num, 0);
   572			if (ret)
   573				goto fail_cleanup;
   574		}
   575	
   576		if (data->irq) {
   577			ret = devm_request_threaded_irq(dev, data->client->irq,
   578							NULL, pca954x_irq_handler,
   579							IRQF_ONESHOT | IRQF_SHARED,
   580							"pca954x", data);
   581			if (ret)
   582				goto fail_cleanup;
   583		}
   584	
   585		/*
   586		 * The attr probably isn't going to be needed in most cases,
   587		 * so don't fail completely on error.
   588		 */
   589		device_create_file(dev, &dev_attr_idle_state);
   590	
   591		dev_info(dev, "registered %d multiplexed busses for I2C %s %s\n",
   592			 num, data->chip->muxtype == pca954x_ismux
   593					? "mux" : "switch", client->name);
   594	
   595		return 0;
   596	
   597	fail_cleanup:
   598		pca954x_cleanup(muxc);
   599		return ret;
   600	}
   601	

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

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

* Re: [PATCH 4/4] i2c-mux-pca954x: Add regulator support
@ 2021-12-14 13:12     ` kernel test robot
  0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2021-12-14 13:12 UTC (permalink / raw)
  To: kbuild-all

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

Hi Patrick,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on wsa/i2c/for-next]
[also build test WARNING on robh/for-next linux/master linus/master v5.16-rc5]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Patrick-Rudolph/dt-bindings-i2c-Update-PCA954x/20211214-175258
base:   https://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/for-next
config: riscv-randconfig-r042-20211214 (https://download.01.org/0day-ci/archive/20211214/202112142101.s4i5cHhd-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project b6a2ddb6c8ac29412b1361810972e15221fa021c)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/3498c52eb6aec09c78a3f07cdcb042897960f8ef
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Patrick-Rudolph/dt-bindings-i2c-Update-PCA954x/20211214-175258
        git checkout 3498c52eb6aec09c78a3f07cdcb042897960f8ef
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/i2c/muxes/

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

All warnings (new ones prefixed by >>):

>> drivers/i2c/muxes/i2c-mux-pca954x.c:502:58: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
                   dev_warn(dev, "Failed to get regulator for vcc: %d\n", ret);
                                                                          ^~~
   include/linux/dev_printk.h:146:70: note: expanded from macro 'dev_warn'
           dev_printk_index_wrap(_dev_warn, KERN_WARNING, dev, dev_fmt(fmt), ##__VA_ARGS__)
                                                                               ^~~~~~~~~~~
   include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
                   _p_func(dev, fmt, ##__VA_ARGS__);                       \
                                       ^~~~~~~~~~~
   drivers/i2c/muxes/i2c-mux-pca954x.c:483:9: note: initialize the variable 'ret' to silence this warning
           int ret;
                  ^
                   = 0
   1 warning generated.


vim +/ret +502 drivers/i2c/muxes/i2c-mux-pca954x.c

   470	
   471	/*
   472	 * I2C init/probing/exit functions
   473	 */
   474	static int pca954x_probe(struct i2c_client *client,
   475				 const struct i2c_device_id *id)
   476	{
   477		struct i2c_adapter *adap = client->adapter;
   478		struct device *dev = &client->dev;
   479		struct gpio_desc *gpio;
   480		struct i2c_mux_core *muxc;
   481		struct pca954x *data;
   482		int num;
   483		int ret;
   484	
   485		if (!i2c_check_functionality(adap, I2C_FUNC_SMBUS_BYTE))
   486			return -ENODEV;
   487	
   488		muxc = i2c_mux_alloc(adap, dev, PCA954X_MAX_NCHANS, sizeof(*data), 0,
   489				     pca954x_select_chan, pca954x_deselect_mux);
   490		if (!muxc)
   491			return -ENOMEM;
   492	
   493		data = i2c_mux_priv(muxc);
   494	
   495		i2c_set_clientdata(client, muxc);
   496		data->client = client;
   497	
   498		data->supply = devm_regulator_get(dev, "vcc");
   499		if (IS_ERR(data->supply)) {
   500			if ((PTR_ERR(data->supply) == -EPROBE_DEFER))
   501				return -EPROBE_DEFER;
 > 502			dev_warn(dev, "Failed to get regulator for vcc: %d\n", ret);
   503		} else {
   504			ret = regulator_enable(data->supply);
   505			if (ret) {
   506				dev_err(dev, "Failed to enable regulator vcc\n");
   507				return ret;
   508			}
   509		}
   510	
   511		/* Reset the mux if a reset GPIO is specified. */
   512		gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
   513		if (IS_ERR(gpio)) {
   514			ret = PTR_ERR(gpio);
   515			goto fail_cleanup;
   516		}
   517		if (gpio) {
   518			udelay(1);
   519			gpiod_set_value_cansleep(gpio, 0);
   520			/* Give the chip some time to recover. */
   521			udelay(1);
   522		}
   523	
   524		data->chip = device_get_match_data(dev);
   525		if (!data->chip)
   526			data->chip = &chips[id->driver_data];
   527	
   528		if (data->chip->id.manufacturer_id != I2C_DEVICE_ID_NONE) {
   529			struct i2c_device_identity id;
   530	
   531			ret = i2c_get_device_id(client, &id);
   532			if (ret && ret != -EOPNOTSUPP)
   533				goto fail_cleanup;
   534	
   535			if (!ret &&
   536			    (id.manufacturer_id != data->chip->id.manufacturer_id ||
   537			     id.part_id != data->chip->id.part_id)) {
   538				dev_warn(dev, "unexpected device id %03x-%03x-%x\n",
   539					 id.manufacturer_id, id.part_id,
   540					 id.die_revision);
   541				ret = -ENODEV;
   542				goto fail_cleanup;
   543			}
   544		}
   545	
   546		data->idle_state = MUX_IDLE_AS_IS;
   547		if (device_property_read_u32(dev, "idle-state", &data->idle_state)) {
   548			if (device_property_read_bool(dev, "i2c-mux-idle-disconnect"))
   549				data->idle_state = MUX_IDLE_DISCONNECT;
   550		}
   551	
   552		/*
   553		 * Write the mux register at addr to verify
   554		 * that the mux is in fact present. This also
   555		 * initializes the mux to a channel
   556		 * or disconnected state.
   557		 */
   558		ret = pca954x_init(client, data);
   559		if (ret < 0) {
   560			dev_warn(dev, "probe failed\n");
   561			ret = -ENODEV;
   562			goto fail_cleanup;
   563		}
   564	
   565		ret = pca954x_irq_setup(muxc);
   566		if (ret)
   567			goto fail_cleanup;
   568	
   569		/* Now create an adapter for each channel */
   570		for (num = 0; num < data->chip->nchans; num++) {
   571			ret = i2c_mux_add_adapter(muxc, 0, num, 0);
   572			if (ret)
   573				goto fail_cleanup;
   574		}
   575	
   576		if (data->irq) {
   577			ret = devm_request_threaded_irq(dev, data->client->irq,
   578							NULL, pca954x_irq_handler,
   579							IRQF_ONESHOT | IRQF_SHARED,
   580							"pca954x", data);
   581			if (ret)
   582				goto fail_cleanup;
   583		}
   584	
   585		/*
   586		 * The attr probably isn't going to be needed in most cases,
   587		 * so don't fail completely on error.
   588		 */
   589		device_create_file(dev, &dev_attr_idle_state);
   590	
   591		dev_info(dev, "registered %d multiplexed busses for I2C %s %s\n",
   592			 num, data->chip->muxtype == pca954x_ismux
   593					? "mux" : "switch", client->name);
   594	
   595		return 0;
   596	
   597	fail_cleanup:
   598		pca954x_cleanup(muxc);
   599		return ret;
   600	}
   601	

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

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

* [PATCH 4/4] i2c-mux-pca954x: Add regulator support
  2021-12-14  9:50 [PATCH 1/4] dt-bindings: i2c Update PCA954x Patrick Rudolph
@ 2021-12-14  9:50 ` Patrick Rudolph
  2021-12-14 13:12     ` kernel test robot
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Rudolph @ 2021-12-14  9:50 UTC (permalink / raw)
  To: Peter Rosin; +Cc: Patrick Rudolph, linux-i2c, linux-kernel

Add an optional vcc regulator and enable it when found for devices
that are powered off by default.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 33 ++++++++++++++++++++++++-----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 23e0f24bab04..5fa266cb02c0 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -48,6 +48,7 @@
 #include <linux/module.h>
 #include <linux/pm.h>
 #include <linux/property.h>
+#include <linux/regulator/consumer.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <dt-bindings/mux/mux.h>
@@ -101,6 +102,7 @@ struct pca954x {
 	struct irq_domain *irq;
 	unsigned int irq_mask;
 	raw_spinlock_t lock;
+	struct regulator *supply;
 };
 
 /* Provide specs for the PCA954x and MAX735x types we know about */
@@ -425,6 +427,9 @@ static void pca954x_cleanup(struct i2c_mux_core *muxc)
 	struct pca954x *data = i2c_mux_priv(muxc);
 	int c, irq;
 
+	if (!IS_ERR_OR_NULL(data->supply))
+		regulator_disable(data->supply);
+
 	if (data->irq) {
 		for (c = 0; c < data->chip->nchans; c++) {
 			irq = irq_find_mapping(data->irq, c);
@@ -484,15 +489,31 @@ static int pca954x_probe(struct i2c_client *client,
 			     pca954x_select_chan, pca954x_deselect_mux);
 	if (!muxc)
 		return -ENOMEM;
+
 	data = i2c_mux_priv(muxc);
 
 	i2c_set_clientdata(client, muxc);
 	data->client = client;
 
+	data->supply = devm_regulator_get(dev, "vcc");
+	if (IS_ERR(data->supply)) {
+		if ((PTR_ERR(data->supply) == -EPROBE_DEFER))
+			return -EPROBE_DEFER;
+		dev_warn(dev, "Failed to get regulator for vcc: %d\n", ret);
+	} else {
+		ret = regulator_enable(data->supply);
+		if (ret) {
+			dev_err(dev, "Failed to enable regulator vcc\n");
+			return ret;
+		}
+	}
+
 	/* Reset the mux if a reset GPIO is specified. */
 	gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
-	if (IS_ERR(gpio))
-		return PTR_ERR(gpio);
+	if (IS_ERR(gpio)) {
+		ret = PTR_ERR(gpio);
+		goto fail_cleanup;
+	}
 	if (gpio) {
 		udelay(1);
 		gpiod_set_value_cansleep(gpio, 0);
@@ -509,7 +530,7 @@ static int pca954x_probe(struct i2c_client *client,
 
 		ret = i2c_get_device_id(client, &id);
 		if (ret && ret != -EOPNOTSUPP)
-			return ret;
+			goto fail_cleanup;
 
 		if (!ret &&
 		    (id.manufacturer_id != data->chip->id.manufacturer_id ||
@@ -517,7 +538,8 @@ static int pca954x_probe(struct i2c_client *client,
 			dev_warn(dev, "unexpected device id %03x-%03x-%x\n",
 				 id.manufacturer_id, id.part_id,
 				 id.die_revision);
-			return -ENODEV;
+			ret = -ENODEV;
+			goto fail_cleanup;
 		}
 	}
 
@@ -536,7 +558,8 @@ static int pca954x_probe(struct i2c_client *client,
 	ret = pca954x_init(client, data);
 	if (ret < 0) {
 		dev_warn(dev, "probe failed\n");
-		return -ENODEV;
+		ret = -ENODEV;
+		goto fail_cleanup;
 	}
 
 	ret = pca954x_irq_setup(muxc);
-- 
2.33.1


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

end of thread, other threads:[~2021-12-14 18:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-14 18:46 [PATCH 4/4] i2c-mux-pca954x: Add regulator support kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-12-14  9:50 [PATCH 1/4] dt-bindings: i2c Update PCA954x Patrick Rudolph
2021-12-14  9:50 ` [PATCH 4/4] i2c-mux-pca954x: Add regulator support Patrick Rudolph
2021-12-14 13:12   ` kernel test robot
2021-12-14 13:12     ` 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.