All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v2 2/2] Input: gpio_keys - Simplify with dev_err_probe()
Date: Mon, 31 Aug 2020 12:44:54 +0300	[thread overview]
Message-ID: <20200831094454.GC8299@kadam> (raw)
In-Reply-To: <20200826200827.30931-2-krzk@kernel.org>

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

Hi Krzysztof,

url:    https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/gpio-Add-devm_fwnode_gpiod_get_optional-helpers/20200827-041021
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: x86_64-randconfig-m001-20200826 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 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>

New smatch warnings:
drivers/input/keyboard/gpio_keys.c:500 gpio_keys_setup_key() error: uninitialized symbol 'error'.

# https://github.com/0day-ci/linux/commit/e138d2340a72b4f117d0da36fe7cddb4bc073c58
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Krzysztof-Kozlowski/gpio-Add-devm_fwnode_gpiod_get_optional-helpers/20200827-041021
git checkout e138d2340a72b4f117d0da36fe7cddb4bc073c58
vim +/error +500 drivers/input/keyboard/gpio_keys.c

5298cc4cc753bb Bill Pemberton      2012-11-23  477  static int gpio_keys_setup_key(struct platform_device *pdev,
d9080921aa32c7 Dmitry Torokhov     2012-03-18  478  				struct input_dev *input,
83e4947a569f4d Hans de Goede       2017-01-21  479  				struct gpio_keys_drvdata *ddata,
700a38b27eefc5 Dmitry Torokhov     2016-10-19  480  				const struct gpio_keys_button *button,
83e4947a569f4d Hans de Goede       2017-01-21  481  				int idx,
700a38b27eefc5 Dmitry Torokhov     2016-10-19  482  				struct fwnode_handle *child)
bc8f1eaf68a8aa Ben Dooks           2009-11-10  483  {
92a47674f57b4a Alexander Stein     2011-04-11  484  	const char *desc = button->desc ? button->desc : "gpio_keys";
9e3af04f878731 Mika Westerberg     2010-02-04  485  	struct device *dev = &pdev->dev;
83e4947a569f4d Hans de Goede       2017-01-21  486  	struct gpio_button_data *bdata = &ddata->data[idx];
d8ee4a1c90529e Laxman Dewangan     2012-03-19  487  	irq_handler_t isr;
9e3af04f878731 Mika Westerberg     2010-02-04  488  	unsigned long irqflags;
27245519f0de50 Alexander Shiyan    2014-04-28  489  	int irq;
27245519f0de50 Alexander Shiyan    2014-04-28  490  	int error;
                                                        ^^^^^^^^^

bc8f1eaf68a8aa Ben Dooks           2009-11-10  491  
d9080921aa32c7 Dmitry Torokhov     2012-03-18  492  	bdata->input = input;
d9080921aa32c7 Dmitry Torokhov     2012-03-18  493  	bdata->button = button;
d8ee4a1c90529e Laxman Dewangan     2012-03-19  494  	spin_lock_init(&bdata->lock);
d8ee4a1c90529e Laxman Dewangan     2012-03-19  495  
700a38b27eefc5 Dmitry Torokhov     2016-10-19  496  	if (child) {
e138d2340a72b4 Krzysztof Kozlowski 2020-08-26  497  		bdata->gpiod = devm_fwnode_gpiod_get_optional(dev, child, NULL,
e138d2340a72b4 Krzysztof Kozlowski 2020-08-26  498  							      GPIOD_IN, desc);
e138d2340a72b4 Krzysztof Kozlowski 2020-08-26  499  		if (IS_ERR(bdata->gpiod))
e138d2340a72b4 Krzysztof Kozlowski 2020-08-26 @500  			return dev_err_probe(dev, error, "failed to get gpio\n");
                                                                                                  ^^^^^
Uninitialized

700a38b27eefc5 Dmitry Torokhov     2016-10-19  501  	} else if (gpio_is_valid(button->gpio)) {
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  502  		/*
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  503  		 * Legacy GPIO number, so request the GPIO here and
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  504  		 * convert it to descriptor.
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  505  		 */
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  506  		unsigned flags = GPIOF_IN;
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  507  
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  508  		if (button->active_low)
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  509  			flags |= GPIOF_ACTIVE_LOW;
bc8f1eaf68a8aa Ben Dooks           2009-11-10  510  
b4e66e7d1948e0 Guenter Roeck       2017-01-21  511  		error = devm_gpio_request_one(dev, button->gpio, flags, desc);
bc8f1eaf68a8aa Ben Dooks           2009-11-10  512  		if (error < 0) {
d8ee4a1c90529e Laxman Dewangan     2012-03-19  513  			dev_err(dev, "Failed to request GPIO %d, error %d\n",
bc8f1eaf68a8aa Ben Dooks           2009-11-10  514  				button->gpio, error);
d8ee4a1c90529e Laxman Dewangan     2012-03-19  515  			return error;
bc8f1eaf68a8aa Ben Dooks           2009-11-10  516  		}
bc8f1eaf68a8aa Ben Dooks           2009-11-10  517  
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  518  		bdata->gpiod = gpio_to_desc(button->gpio);
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  519  		if (!bdata->gpiod)
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  520  			return -EINVAL;
700a38b27eefc5 Dmitry Torokhov     2016-10-19  521  	}

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 40642 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v2 2/2] Input: gpio_keys - Simplify with dev_err_probe()
Date: Mon, 31 Aug 2020 12:44:54 +0300	[thread overview]
Message-ID: <20200831094454.GC8299@kadam> (raw)
In-Reply-To: <20200826200827.30931-2-krzk@kernel.org>

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

Hi Krzysztof,

url:    https://github.com/0day-ci/linux/commits/Krzysztof-Kozlowski/gpio-Add-devm_fwnode_gpiod_get_optional-helpers/20200827-041021
base:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git for-next
config: x86_64-randconfig-m001-20200826 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 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>

New smatch warnings:
drivers/input/keyboard/gpio_keys.c:500 gpio_keys_setup_key() error: uninitialized symbol 'error'.

# https://github.com/0day-ci/linux/commit/e138d2340a72b4f117d0da36fe7cddb4bc073c58
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Krzysztof-Kozlowski/gpio-Add-devm_fwnode_gpiod_get_optional-helpers/20200827-041021
git checkout e138d2340a72b4f117d0da36fe7cddb4bc073c58
vim +/error +500 drivers/input/keyboard/gpio_keys.c

5298cc4cc753bb Bill Pemberton      2012-11-23  477  static int gpio_keys_setup_key(struct platform_device *pdev,
d9080921aa32c7 Dmitry Torokhov     2012-03-18  478  				struct input_dev *input,
83e4947a569f4d Hans de Goede       2017-01-21  479  				struct gpio_keys_drvdata *ddata,
700a38b27eefc5 Dmitry Torokhov     2016-10-19  480  				const struct gpio_keys_button *button,
83e4947a569f4d Hans de Goede       2017-01-21  481  				int idx,
700a38b27eefc5 Dmitry Torokhov     2016-10-19  482  				struct fwnode_handle *child)
bc8f1eaf68a8aa Ben Dooks           2009-11-10  483  {
92a47674f57b4a Alexander Stein     2011-04-11  484  	const char *desc = button->desc ? button->desc : "gpio_keys";
9e3af04f878731 Mika Westerberg     2010-02-04  485  	struct device *dev = &pdev->dev;
83e4947a569f4d Hans de Goede       2017-01-21  486  	struct gpio_button_data *bdata = &ddata->data[idx];
d8ee4a1c90529e Laxman Dewangan     2012-03-19  487  	irq_handler_t isr;
9e3af04f878731 Mika Westerberg     2010-02-04  488  	unsigned long irqflags;
27245519f0de50 Alexander Shiyan    2014-04-28  489  	int irq;
27245519f0de50 Alexander Shiyan    2014-04-28  490  	int error;
                                                        ^^^^^^^^^

bc8f1eaf68a8aa Ben Dooks           2009-11-10  491  
d9080921aa32c7 Dmitry Torokhov     2012-03-18  492  	bdata->input = input;
d9080921aa32c7 Dmitry Torokhov     2012-03-18  493  	bdata->button = button;
d8ee4a1c90529e Laxman Dewangan     2012-03-19  494  	spin_lock_init(&bdata->lock);
d8ee4a1c90529e Laxman Dewangan     2012-03-19  495  
700a38b27eefc5 Dmitry Torokhov     2016-10-19  496  	if (child) {
e138d2340a72b4 Krzysztof Kozlowski 2020-08-26  497  		bdata->gpiod = devm_fwnode_gpiod_get_optional(dev, child, NULL,
e138d2340a72b4 Krzysztof Kozlowski 2020-08-26  498  							      GPIOD_IN, desc);
e138d2340a72b4 Krzysztof Kozlowski 2020-08-26  499  		if (IS_ERR(bdata->gpiod))
e138d2340a72b4 Krzysztof Kozlowski 2020-08-26 @500  			return dev_err_probe(dev, error, "failed to get gpio\n");
                                                                                                  ^^^^^
Uninitialized

700a38b27eefc5 Dmitry Torokhov     2016-10-19  501  	} else if (gpio_is_valid(button->gpio)) {
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  502  		/*
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  503  		 * Legacy GPIO number, so request the GPIO here and
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  504  		 * convert it to descriptor.
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  505  		 */
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  506  		unsigned flags = GPIOF_IN;
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  507  
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  508  		if (button->active_low)
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  509  			flags |= GPIOF_ACTIVE_LOW;
bc8f1eaf68a8aa Ben Dooks           2009-11-10  510  
b4e66e7d1948e0 Guenter Roeck       2017-01-21  511  		error = devm_gpio_request_one(dev, button->gpio, flags, desc);
bc8f1eaf68a8aa Ben Dooks           2009-11-10  512  		if (error < 0) {
d8ee4a1c90529e Laxman Dewangan     2012-03-19  513  			dev_err(dev, "Failed to request GPIO %d, error %d\n",
bc8f1eaf68a8aa Ben Dooks           2009-11-10  514  				button->gpio, error);
d8ee4a1c90529e Laxman Dewangan     2012-03-19  515  			return error;
bc8f1eaf68a8aa Ben Dooks           2009-11-10  516  		}
bc8f1eaf68a8aa Ben Dooks           2009-11-10  517  
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  518  		bdata->gpiod = gpio_to_desc(button->gpio);
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  519  		if (!bdata->gpiod)
5feeca3c1e39c0 Geert Uytterhoeven  2016-10-19  520  			return -EINVAL;
700a38b27eefc5 Dmitry Torokhov     2016-10-19  521  	}

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 40642 bytes --]

  parent reply	other threads:[~2020-08-31  9:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-26 20:08 [PATCH v2 1/2] gpio: Add devm_fwnode_gpiod_get_optional() helpers Krzysztof Kozlowski
2020-08-26 20:08 ` [PATCH v2 2/2] Input: gpio_keys - Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-27  0:06   ` kernel test robot
     [not found]   ` <CAHp75VcgE+HJOKkV6-crzH1w+qOtSKR8=i1Y3ufnhTiAcYV=7A@mail.gmail.com>
2020-08-27  6:17     ` Krzysztof Kozlowski
2020-08-31  9:44   ` Dan Carpenter [this message]
2020-08-31  9:44     ` Dan Carpenter
2020-08-31 13:57     ` Krzysztof Kozlowski
     [not found] ` <CAHp75VfSE_9D4UBwJLt2b_JyBLiN_giOd8mWpodbMAVJ8wj=cA@mail.gmail.com>
2020-08-27  6:16   ` [PATCH v2 1/2] gpio: Add devm_fwnode_gpiod_get_optional() helpers Krzysztof Kozlowski
  -- strict thread matches above, loose matches on Subject: below --
2020-08-27  3:35 [PATCH v2 2/2] Input: gpio_keys - Simplify with dev_err_probe() kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200831094454.GC8299@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.