Re: [PATCH v2 2/6] iio: light: stk3310: Implement vdd supply and power it off during suspend

Dan Carpenter
2024-04-25T05:31:50Z

Hi Aren,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Aren-Moynihan/dt-bindings-iio-light-stk33xx-add-vdd-and-leda-regulators/20240424-064250
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link: https://lore.kernel.org/r/20240423223309.1468198-4-aren%40peacevolution.org
patch subject: [PATCH v2 2/6] iio: light: stk3310: Implement vdd supply and power it off during suspend
config: i386-randconfig-141-20240424 (https://download.01.org/0day-ci/archive/20240425/202404251021.4OPER3OS-lkp@intel.com/config)
compiler: gcc-10 (Ubuntu 10.5.0-1ubuntu1) 10.5.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202404251021.4OPER3OS-lkp@intel.com/

smatch warnings:
drivers/iio/light/stk3310.c:615 stk3310_probe() error: uninitialized symbol 'ret'.

vim +/ret +615 drivers/iio/light/stk3310.c

9046d80dce04c6 Uwe Kleine-König 2022-11-18 592 static int stk3310_probe(struct i2c_client *client)
be9e6229d67696 Tiberiu Breana 2015-04-27 593 {
be9e6229d67696 Tiberiu Breana 2015-04-27 594 int ret;
be9e6229d67696 Tiberiu Breana 2015-04-27 595 struct iio_dev *indio_dev;
be9e6229d67696 Tiberiu Breana 2015-04-27 596 struct stk3310_data *data;
be9e6229d67696 Tiberiu Breana 2015-04-27 597
be9e6229d67696 Tiberiu Breana 2015-04-27 598 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
be9e6229d67696 Tiberiu Breana 2015-04-27 599 if (!indio_dev) {
be9e6229d67696 Tiberiu Breana 2015-04-27 600 dev_err(&client->dev, "iio allocation failed!\n");
be9e6229d67696 Tiberiu Breana 2015-04-27 601 return -ENOMEM;
be9e6229d67696 Tiberiu Breana 2015-04-27 602 }
be9e6229d67696 Tiberiu Breana 2015-04-27 603
be9e6229d67696 Tiberiu Breana 2015-04-27 604 data = iio_priv(indio_dev);
be9e6229d67696 Tiberiu Breana 2015-04-27 605 data->client = client;
be9e6229d67696 Tiberiu Breana 2015-04-27 606 i2c_set_clientdata(client, indio_dev);
d6ecb01583d4e0 Arnaud Ferraris 2022-04-20 607
d6ecb01583d4e0 Arnaud Ferraris 2022-04-20 608 device_property_read_u32(&client->dev, "proximity-near-level",
d6ecb01583d4e0 Arnaud Ferraris 2022-04-20 609 &data->ps_near_level);
d6ecb01583d4e0 Arnaud Ferraris 2022-04-20 610
be9e6229d67696 Tiberiu Breana 2015-04-27 611 mutex_init(&data->lock);
be9e6229d67696 Tiberiu Breana 2015-04-27 612
dd231c1d219f6b Ondrej Jirman 2024-04-23 613 data->vdd_reg = devm_regulator_get(&client->dev, "vdd");
dd231c1d219f6b Ondrej Jirman 2024-04-23 614 if (IS_ERR(data->vdd_reg))
dd231c1d219f6b Ondrej Jirman 2024-04-23 @615 return dev_err_probe(&client->dev, ret, "get regulator vdd failed\n");

s/ret/PTR_ERR(data->vdd_reg)/

dd231c1d219f6b Ondrej Jirman 2024-04-23 616
be9e6229d67696 Tiberiu Breana 2015-04-27 617 ret = stk3310_regmap_init(data);
be9e6229d67696 Tiberiu Breana 2015-04-27 618 if (ret < 0)
be9e6229d67696 Tiberiu Breana 2015-04-27 619 return ret;
be9e6229d67696 Tiberiu Breana 2015-04-27 620
be9e6229d67696 Tiberiu Breana 2015-04-27 621 indio_dev->info = &stk3310_info;
be9e6229d67696 Tiberiu Breana 2015-04-27 622 indio_dev->name = STK3310_DRIVER_NAME;
be9e6229d67696 Tiberiu Breana 2015-04-27 623 indio_dev->modes = INDIO_DIRECT_MODE;
be9e6229d67696 Tiberiu Breana 2015-04-27 624 indio_dev->channels = stk3310_channels;
be9e6229d67696 Tiberiu Breana 2015-04-27 625 indio_dev->num_channels = ARRAY_SIZE(stk3310_channels);
be9e6229d67696 Tiberiu Breana 2015-04-27 626
dd231c1d219f6b Ondrej Jirman 2024-04-23 627 ret = regulator_enable(data->vdd_reg);
dd231c1d219f6b Ondrej Jirman 2024-04-23 628 if (ret)
dd231c1d219f6b Ondrej Jirman 2024-04-23 629 return dev_err_probe(&client->dev, ret,
dd231c1d219f6b Ondrej Jirman 2024-04-23 630 "regulator vdd enable failed\n");
dd231c1d219f6b Ondrej Jirman 2024-04-23 631
dd231c1d219f6b Ondrej Jirman 2024-04-23 632 /* we need a short delay to allow the chip time to power on */
dd231c1d219f6b Ondrej Jirman 2024-04-23 633 fsleep(1000);
dd231c1d219f6b Ondrej Jirman 2024-04-23 634
be9e6229d67696 Tiberiu Breana 2015-04-27 635 ret = stk3310_init(indio_dev);
be9e6229d67696 Tiberiu Breana 2015-04-27 636 if (ret < 0)
dd231c1d219f6b Ondrej Jirman 2024-04-23 637 goto err_vdd_disable;
be9e6229d67696 Tiberiu Breana 2015-04-27 638
6839c1b0700a79 Octavian Purdila 2015-09-23 639 if (client->irq > 0) {
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 640 ret = devm_request_threaded_irq(&client->dev, client->irq,
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 641 stk3310_irq_handler,
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 642 stk3310_irq_event_handler,
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 643 IRQF_TRIGGER_FALLING |
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 644 IRQF_ONESHOT,
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 645 STK3310_EVENT, indio_dev);
7c7a9eeaa335df Hartmut Knaack 2015-07-09 646 if (ret < 0) {
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 647 dev_err(&client->dev, "request irq %d failed\n",
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 648 client->irq);
7c7a9eeaa335df Hartmut Knaack 2015-07-09 649 goto err_standby;
7c7a9eeaa335df Hartmut Knaack 2015-07-09 650 }
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 651 }
3dd477acbdd1f1 Tiberiu Breana 2015-04-27 652
037e966f2d6389 Hartmut Knaack 2015-07-09 653 ret = iio_device_register(indio_dev);
037e966f2d6389 Hartmut Knaack 2015-07-09 654 if (ret < 0) {
037e966f2d6389 Hartmut Knaack 2015-07-09 655 dev_err(&client->dev, "device_register failed\n");
7c7a9eeaa335df Hartmut Knaack 2015-07-09 656 goto err_standby;
037e966f2d6389 Hartmut Knaack 2015-07-09 657 }
037e966f2d6389 Hartmut Knaack 2015-07-09 658
7c7a9eeaa335df Hartmut Knaack 2015-07-09 659 return 0;
7c7a9eeaa335df Hartmut Knaack 2015-07-09 660
7c7a9eeaa335df Hartmut Knaack 2015-07-09 661 err_standby:
7c7a9eeaa335df Hartmut Knaack 2015-07-09 662 stk3310_set_state(data, STK3310_STATE_STANDBY);
dd231c1d219f6b Ondrej Jirman 2024-04-23 663 err_vdd_disable:
dd231c1d219f6b Ondrej Jirman 2024-04-23 664 regulator_disable(data->vdd_reg);
be9e6229d67696 Tiberiu Breana 2015-04-27 665 return ret;
be9e6229d67696 Tiberiu Breana 2015-04-27 666 }

--
0-DAY CI Kernel Test Service