From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Nathan Chancellor <nathan@kernel.org>
Cc: ndesaulniers@google.com, trix@redhat.com, frank.li@vivo.com,
linux-input@vger.kernel.org, llvm@lists.linux.dev,
patches@lists.linux.dev
Subject: Re: [PATCH] Input: mcs-touchkey - Fix uninitialized use of error in mcs_touchkey_probe()
Date: Tue, 25 Jul 2023 09:54:34 -0700 [thread overview]
Message-ID: <ZL/+SuXswTMjXDUv@google.com> (raw)
In-Reply-To: <20230725-mcs_touchkey-fix-wuninitialized-v1-1-615db39af51c@kernel.org>
On Tue, Jul 25, 2023 at 08:37:56AM -0700, Nathan Chancellor wrote:
> Clang warns (or errors with CONFIG_WERROR=y):
>
> drivers/input/keyboard/mcs_touchkey.c:149:49: error: variable 'error' is uninitialized when used here [-Werror,-Wuninitialized]
> 149 | dev_err(&client->dev, "i2c read error[%d]\n", error);
> | ^~~~~
> include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
> 144 | dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
> | ^~~~~~~~~~~
> include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
> 110 | _p_func(dev, fmt, ##__VA_ARGS__); \
> | ^~~~~~~~~~~
> drivers/input/keyboard/mcs_touchkey.c:110:11: note: initialize the variable 'error' to silence this warning
> 110 | int error;
> | ^
> | = 0
> 1 error generated.
>
> A refactoring updated the error handling in this block but did not
> update the dev_err() call to use fw_ver instead of error. Do so now to
> fix the warning and avoid printing uninitialized memory.
>
> Closes: https://github.com/ClangBuiltLinux/linux/issues/1893
> Fixes: e175eae16c1b ("Input: mcs-touchkey - convert to use devm_* api")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Applied, thank you.
--
Dmitry
prev parent reply other threads:[~2023-07-25 16:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 15:37 [PATCH] Input: mcs-touchkey - Fix uninitialized use of error in mcs_touchkey_probe() Nathan Chancellor
2023-07-25 16:54 ` 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=ZL/+SuXswTMjXDUv@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=frank.li@vivo.com \
--cc=linux-input@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=patches@lists.linux.dev \
--cc=trix@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox