From: Dan Carpenter <dan.carpenter@oracle.com>
To: Yu Zhe <yuzhe@nfschina.com>
Cc: dinguyen@kernel.org, bp@alien8.de, mchehab@kernel.org,
tony.luck@intel.com, james.morse@arm.com, rric@kernel.org,
linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org, liqiong@nfschina.com
Subject: Re: [PATCH] EDAC/altera: add platform_get_irq error checking
Date: Mon, 12 Sep 2022 14:26:46 +0300 [thread overview]
Message-ID: <Yx8Xds2BrK7PNjXJ@kadam> (raw)
In-Reply-To: <20220909053839.2293-1-yuzhe@nfschina.com>
On Fri, Sep 09, 2022 at 01:38:38PM +0800, Yu Zhe wrote:
> The platform_get_irq() function returns negative error codes on error,
> check it.
>
> Signed-off-by: Yu Zhe <yuzhe@nfschina.com>
> ---
> drivers/edac/altera_edac.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c
> index e7e8e624a436..79c7c97c7a46 100644
> --- a/drivers/edac/altera_edac.c
> +++ b/drivers/edac/altera_edac.c
> @@ -355,6 +355,8 @@ static int altr_sdram_probe(struct platform_device *pdev)
>
> /* Arria10 has a 2nd IRQ */
> irq2 = platform_get_irq(pdev, 1);
> + if (irq2 < 0)
> + return irq2;
This will break the driver. Only certain hardware has the second IRQ.
(Read the comments later in the probe). In fact, the code works fine
as-is because devm_request_irq() will fail later if this IRQ is
required.
This code is not beautiful. It should only request the IRQ in cases
where it is present, but it used to work correctly and now it will be
broken.
regards,
dan carpenter
prev parent reply other threads:[~2022-09-12 11:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-09 5:38 [PATCH] EDAC/altera: add platform_get_irq error checking Yu Zhe
2022-09-12 11:26 ` Dan Carpenter [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=Yx8Xds2BrK7PNjXJ@kadam \
--to=dan.carpenter@oracle.com \
--cc=bp@alien8.de \
--cc=dinguyen@kernel.org \
--cc=james.morse@arm.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liqiong@nfschina.com \
--cc=mchehab@kernel.org \
--cc=rric@kernel.org \
--cc=tony.luck@intel.com \
--cc=yuzhe@nfschina.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