From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Haoran Liu <liuhaoran14@163.com>
Cc: claudiu.beznea@tuxon.dev, sre@kernel.org,
nicolas.ferre@microchip.com, linux-pm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [power/reset] at91-sama5d2: Add error handling in at91_shdwc_probe
Date: Wed, 29 Nov 2023 18:15:55 +0100 [thread overview]
Message-ID: <20231129171555abae472b@mail.local> (raw)
In-Reply-To: <20231129132939.34047-1-liuhaoran14@163.com>
On 29/11/2023 05:29:39-0800, Haoran Liu wrote:
> This patch adds error handling to the at91_shdwc_probe function
> in drivers/power/reset/at91-sama5d2_shdwc.c. The function
> previously did not handle the case where of_match_node could fail,
> potentially leading to unexpected behavior if the device tree match
> was unsuccessful.
>
> Signed-off-by: Haoran Liu <liuhaoran14@163.com>
> ---
> drivers/power/reset/at91-sama5d2_shdwc.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/power/reset/at91-sama5d2_shdwc.c b/drivers/power/reset/at91-sama5d2_shdwc.c
> index e76b102b57b1..2ac566c83aec 100644
> --- a/drivers/power/reset/at91-sama5d2_shdwc.c
> +++ b/drivers/power/reset/at91-sama5d2_shdwc.c
> @@ -353,6 +353,11 @@ static int __init at91_shdwc_probe(struct platform_device *pdev)
> return PTR_ERR(at91_shdwc->shdwc_base);
>
> match = of_match_node(at91_shdwc_of_match, pdev->dev.of_node);
> + if (!match) {
Can you elaborate how this will ever happen?
> + dev_err(&pdev->dev, "No matching device found\n");
> + return -ENODEV;
> + }
> +
> at91_shdwc->rcfg = match->data;
>
> at91_shdwc->sclk = devm_clk_get(&pdev->dev, NULL);
> --
> 2.17.1
>
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
prev parent reply other threads:[~2023-11-29 17:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-29 13:29 [PATCH] [power/reset] at91-sama5d2: Add error handling in at91_shdwc_probe Haoran Liu
2023-11-29 13:43 ` Nicolas Ferre
2023-11-29 17:15 ` Alexandre Belloni [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=20231129171555abae472b@mail.local \
--to=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=liuhaoran14@163.com \
--cc=nicolas.ferre@microchip.com \
--cc=sre@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox