All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: alexander.stein@systec-electronic.com,
	linux-input@vger.kernel.org,
	Fabio Estevam <fabio.estevam@freescale.com>
Subject: Re: [PATCH] Input: gpio_keys - initialize the 'irq' variable
Date: Sun, 7 Dec 2014 22:48:50 -0800	[thread overview]
Message-ID: <20141208064850.GA29729@dtor-ws> (raw)
In-Reply-To: <1417880632-13559-1-git-send-email-festevam@gmail.com>

Hi Fabio,

On Sat, Dec 06, 2014 at 01:43:52PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Commit f2d347ff70be453e ("Input: gpio_keys - add device tree support for
> interrupt only keys") caused the following build warning:
> 
> drivers/input/keyboard/gpio_keys.c: In function 'gpio_keys_probe':
> drivers/input/keyboard/gpio_keys.c:647:15: warning: 'irq' may be used uninitialized in this function [-Wmaybe-uninitialized]
> drivers/input/keyboard/gpio_keys.c:622:7: note: 'irq' was declared here
> 
> Initialize 'irq' with a default value to fix it.
> 
> Reported-by: Olof's autobuilder <build@lixom.net>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  drivers/input/keyboard/gpio_keys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index aa13055..70e89d1 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -619,7 +619,7 @@ gpio_keys_get_devtree_pdata(struct device *dev)
>  	i = 0;
>  	for_each_child_of_node(node, pp) {
>  		int gpio = -1;
> -		int irq;
> +		int irq = -EINVAL;

No, this is not good as we'll end up with button->irq, which is unsigned
int, having nonsense value.

I'd rather move assignment into the proper branch.

Thanks.

-- 
Dmitry

      reply	other threads:[~2014-12-08  6:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-06 15:43 [PATCH] Input: gpio_keys - initialize the 'irq' variable Fabio Estevam
2014-12-08  6:48 ` Dmitry Torokhov [this message]

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=20141208064850.GA29729@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=alexander.stein@systec-electronic.com \
    --cc=fabio.estevam@freescale.com \
    --cc=festevam@gmail.com \
    --cc=linux-input@vger.kernel.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.