[arnd-playground:randconfig-5.16-min 169/191] drivers/char/tpm/st33zp24/i2c.c:123 st33zp24_i2c_acpi_request_resources() error: uninitialized symbol 'gpiod_lpcpd'.

From: Dan Carpenter
Date: Wed Dec 01 2021 - 05:05:57 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git randconfig-5.16-min
head: 7a16665b8fd19f170c0c15f1432c90e4750183f2
commit: 19074a13cd9fb8cd329d4f09ac0c28a6323abc9a [169/191] tpm: st33zp24: convert to gpio descriptors
config: x86_64-randconfig-m001-20211128 (https://download.01.org/0day-ci/archive/20211201/202112010127.gh8qvdja-lkp@xxxxxxxxx/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@xxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

smatch warnings:
drivers/char/tpm/st33zp24/i2c.c:123 st33zp24_i2c_acpi_request_resources() error: uninitialized symbol 'gpiod_lpcpd'.

vim +/gpiod_lpcpd +123 drivers/char/tpm/st33zp24/i2c.c

740ec346f32b34 Christophe Ricard 2016-02-23 108 static int st33zp24_i2c_acpi_request_resources(struct i2c_client *client)
22eb90db936755 Christophe Ricard 2016-02-13 109 {
9e0d39d8a6a0a8 Christophe Ricard 2016-03-31 110 struct tpm_chip *chip = i2c_get_clientdata(client);
9e0d39d8a6a0a8 Christophe Ricard 2016-03-31 111 struct st33zp24_dev *tpm_dev = dev_get_drvdata(&chip->dev);
9e0d39d8a6a0a8 Christophe Ricard 2016-03-31 112 struct st33zp24_i2c_phy *phy = tpm_dev->phy_id;
22eb90db936755 Christophe Ricard 2016-02-13 113 struct gpio_desc *gpiod_lpcpd;
32da5633dcb911 Christophe Ricard 2016-03-23 114 struct device *dev = &client->dev;
2d2e376f05f23f Andy Shevchenko 2017-03-15 115 int ret;
2d2e376f05f23f Andy Shevchenko 2017-03-15 116
23c3beae581f7c Andy Shevchenko 2017-06-12 117 ret = devm_acpi_dev_add_driver_gpios(dev, acpi_st33zp24_gpios);
2d2e376f05f23f Andy Shevchenko 2017-03-15 118 if (ret)
2d2e376f05f23f Andy Shevchenko 2017-03-15 119 return ret;
22eb90db936755 Christophe Ricard 2016-02-13 120
22eb90db936755 Christophe Ricard 2016-02-13 121 /* Get LPCPD GPIO from ACPI */
19074a13cd9fb8 Arnd Bergmann 2021-11-11 122 phy->io_lpcpd = devm_gpiod_get_optional(dev, "lpcpd", GPIOD_OUT_HIGH);
22eb90db936755 Christophe Ricard 2016-02-13 @123 if (IS_ERR(gpiod_lpcpd)) {

This is checking the wrong variable.

22eb90db936755 Christophe Ricard 2016-02-13 124 dev_err(&client->dev,
22eb90db936755 Christophe Ricard 2016-02-13 125 "Failed to retrieve lpcpd-gpios from acpi.\n");
19074a13cd9fb8 Arnd Bergmann 2021-11-11 126 phy->io_lpcpd = NULL;
22eb90db936755 Christophe Ricard 2016-02-13 127 /*
22eb90db936755 Christophe Ricard 2016-02-13 128 * lpcpd pin is not specified. This is not an issue as
22eb90db936755 Christophe Ricard 2016-02-13 129 * power management can be also managed by TPM specific
22eb90db936755 Christophe Ricard 2016-02-13 130 * commands. So leave with a success status code.
22eb90db936755 Christophe Ricard 2016-02-13 131 */
22eb90db936755 Christophe Ricard 2016-02-13 132 return 0;
22eb90db936755 Christophe Ricard 2016-02-13 133 }
22eb90db936755 Christophe Ricard 2016-02-13 134
22eb90db936755 Christophe Ricard 2016-02-13 135 return 0;
22eb90db936755 Christophe Ricard 2016-02-13 136 }

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