Re: [PATCH 5/7] mfd / platform: cros_ec: move device sysfs attributes to its own driver.

Dan Carpenter
2018-11-29T11:22:09Z

Hi Enric,

I love your patch! Perhaps something to improve:

url: https://github.com/0day-ci/linux/commits/Enric-Balletbo-i-Serra/mfd-cros_ec-use-devm_mfd_add_devices/20181123-025253

smatch warnings:
drivers/platform/chrome/cros_ec_sysfs.c:366 cros_ec_sysfs_probe() warn: variable dereferenced before check 'ec_dev' (see line 362)

# https://github.com/0day-ci/linux/commit/b3074e331f36fff8890e7bd5c1f5874f4c59d38f
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout b3074e331f36fff8890e7bd5c1f5874f4c59d38f
vim +/ec_dev +366 drivers/platform/chrome/cros_ec_sysfs.c

b3074e33 Enric Balletbo i Serra 2018-11-22 358
b3074e33 Enric Balletbo i Serra 2018-11-22 359 static int cros_ec_sysfs_probe(struct platform_device *pd)
b3074e33 Enric Balletbo i Serra 2018-11-22 360 {
b3074e33 Enric Balletbo i Serra 2018-11-22 361 struct cros_ec_dev *ec_dev = dev_get_drvdata(pd->dev.parent);
b3074e33 Enric Balletbo i Serra 2018-11-22 @362 struct cros_ec_platform *ec_platform = dev_get_platdata(ec_dev->dev);
^^^^^^^^^^^
b3074e33 Enric Balletbo i Serra 2018-11-22 363 struct device *dev = &pd->dev;
b3074e33 Enric Balletbo i Serra 2018-11-22 364 int ret;
b3074e33 Enric Balletbo i Serra 2018-11-22 365
b3074e33 Enric Balletbo i Serra 2018-11-22 @366 if (!ec_dev) {
^^^^^^
Presumable this test can be removed?

b3074e33 Enric Balletbo i Serra 2018-11-22 367 dev_err(dev, "No EC dev found\n");
b3074e33 Enric Balletbo i Serra 2018-11-22 368 return -EINVAL;
b3074e33 Enric Balletbo i Serra 2018-11-22 369 }
b3074e33 Enric Balletbo i Serra 2018-11-22 370

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation