From: Stephen Warren <swarren@wwwdotorg.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: linus.walleij@linaro.org, thierry.reding@gmail.com,
gnurou@gmail.com, rklein@nvidia.com, linux-gpio@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] pinctrl: tegra: Correctly check the supported configuration
Date: Mon, 2 May 2016 10:46:36 -0600 [thread overview]
Message-ID: <5727846C.1090309@wwwdotorg.org> (raw)
In-Reply-To: <1462199330-1536-2-git-send-email-ldewangan@nvidia.com>
On 05/02/2016 08:28 AM, Laxman Dewangan wrote:
> The pincontrol registers of Tegra chips has multiple filed per
> registers. There is two type of registers mux and drive. All
> configurations belongs to one of these registers.
>
> If any configurations are supported then <config>_bit is set to
> bit position of these registers otherwise -1 to not support it.
> The member is defined as
> s32 <config>_bit:6;
>
> So if config is not supported ifor given SoC then it is set to -1
> in soc pinmmux table.
> In common driver code, to find out that given config is supported
> or not, it is checked as:
>
> s8 bit = <config>_bit;
> if (bit > 31) {
> /* Not supported */
> }
>
> But in this case, bit is s8 and hence for non supporting it is -1.
>
> Correct the check as:
> if (bit < 0 || bit > 31) {
> /* Not supported */
> }
>
> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
> ---
> I think it should go on stable.
>
> drivers/pinctrl/tegra/pinctrl-tegra.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pinctrl/tegra/pinctrl-tegra.c b/drivers/pinctrl/tegra/pinctrl-tegra.c
> index fb00129..cc117f7 100644
> --- a/drivers/pinctrl/tegra/pinctrl-tegra.c
> +++ b/drivers/pinctrl/tegra/pinctrl-tegra.c
> @@ -417,7 +417,7 @@ static int tegra_pinconf_reg(struct tegra_pmx *pmx,
> return -ENOTSUPP;
> }
>
> - if (*reg < 0 || *bit > 31) {
> + if (*reg < 0 || *bit < 0 || *bit > 31) {
May as well only test (*bit < 0)? Same for your other patch.
It'd be good to add the following tag to the commit description:
Fixes: e4c02dced975 ("pinctrl: tegra: use signed bitfields for optional
fields")
This patch has the potential to suddenly catch more invalid
configurations than it used to, and thus break some boards. However, I
think this actually is safe; any errors that will be caught after this
patch would have been caught before the "signed bitfields" patch above,
and briefly looking at the (subject lines of) patches that have gone in
since the "signed bitfields" patch was applied, I don't think we'll see
any new issues.
next prev parent reply other threads:[~2016-05-02 16:48 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-02 14:28 [PATCH 1/1] pinctrl: tegra: avoid parked_reg and parked_bank Laxman Dewangan
2016-05-02 14:28 ` [PATCH] pinctrl: tegra: Correctly check the supported configuration Laxman Dewangan
2016-05-02 16:46 ` Stephen Warren [this message]
2016-05-02 15:07 ` [PATCH 1/1] pinctrl: tegra: avoid parked_reg and parked_bank Rhyland Klein
2016-05-02 17:59 ` Laxman Dewangan
2016-05-11 11:25 ` Linus Walleij
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=5727846C.1090309@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=gnurou@gmail.com \
--cc=ldewangan@nvidia.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=rklein@nvidia.com \
--cc=thierry.reding@gmail.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