From: Thierry Reding <thierry.reding@gmail.com>
To: Zhang Shurong <zhang_shurong@foxmail.com>
Cc: ldewangan@nvidia.com, broonie@kernel.org, jonathanh@nvidia.com,
p.zabel@pengutronix.de, linux-spi@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: tegra20-sflash: Fix signedness bug in tegra_sflash_probe
Date: Mon, 17 Jul 2023 09:30:31 +0200 [thread overview]
Message-ID: <ZLTuFyYewf8pUiRw@orome> (raw)
In-Reply-To: <tencent_4D4974DE0CD4266C25819179B42888A3E20A@qq.com>
[-- Attachment #1: Type: text/plain, Size: 1353 bytes --]
On Sat, Jul 15, 2023 at 05:53:56PM +0800, Zhang Shurong wrote:
> The "tsd->irq" variable is unsigned so this error handling
> code will not work.
>
> Fix this by adding error handling statement
This doesn't really make sense. First you say that the error handling
will not work and then you say you fix that by adding error handling.
So the bug here is that there is no error checking in the first place,
so you should probably reword that commit message.
Thierry
>
> Fixes: 8528547bcc33 ("spi: tegra: add spi driver for sflash controller")
> Signed-off-by: Zhang Shurong <zhang_shurong@foxmail.com>
> ---
> drivers/spi/spi-tegra20-sflash.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
> index 4286310628a2..4c18337de813 100644
> --- a/drivers/spi/spi-tegra20-sflash.c
> +++ b/drivers/spi/spi-tegra20-sflash.c
> @@ -455,7 +455,11 @@ static int tegra_sflash_probe(struct platform_device *pdev)
> goto exit_free_master;
> }
>
> - tsd->irq = platform_get_irq(pdev, 0);
> + ret = platform_get_irq(pdev, 0);
> + if (ret < 0)
> + goto exit_free_master;
> +
> + tsd->irq = ret;
> ret = request_irq(tsd->irq, tegra_sflash_isr, 0,
> dev_name(&pdev->dev), tsd);
> if (ret < 0) {
> --
> 2.30.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2023-07-17 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-15 9:53 [PATCH] spi: tegra20-sflash: Fix signedness bug in tegra_sflash_probe Zhang Shurong
2023-07-17 7:30 ` Thierry Reding [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=ZLTuFyYewf8pUiRw@orome \
--to=thierry.reding@gmail.com \
--cc=broonie@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=zhang_shurong@foxmail.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;
as well as URLs for NNTP newsgroup(s).