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

From: Enric Balletbo i Serra
Date: Thu Nov 29 2018 - 09:43:26 EST


Hi Dan,

On 29/11/18 12:21, Dan Carpenter wrote:
> 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?
>

Yes, Guenter detected this and I already sent another patchset that removes
this. Thanks.

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

I had this question on my mind for some time but I didn't look for an answer, in
fact, I'm not sure if I already asked you this before, sorry about that if I
did, the question is. There is a easy way to run your smatch scripts locally to
check the patch before I send to the ML?

Best regards,
Enric