From: Shawn Guo <shawnguo@kernel.org>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
Philipp Zabel <p.zabel@pengutronix.de>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
Shawn Guo <shawnguo@kernel.org>
Subject: [PATCH] clk: hisilicon: reset: Use kzalloc instead of kmalloc
Date: Tue, 24 Feb 2026 10:19:12 +0800 [thread overview]
Message-ID: <20260224021912.54365-1-shawnguo@kernel.org> (raw)
With commit c721f189e89c ("reset: Instantiate reset GPIO controller for
shared reset-gpios") in place, the call sequence hisi_reset_init() ->
reset_controller_register() starts failing on Hi3798CV200 Poplar platform,
due to the new check added by the commit above.
if (rcdev->of_node && rcdev->of_args)
return -EINVAL;
The failure is caused by that hisi_reset_init() allocates memory for rcdev
without zeroing it out. Fix the issue by using kzalloc instead of
kmalloc for memory allocation.
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
---
drivers/clk/hisilicon/reset.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/clk/hisilicon/reset.c b/drivers/clk/hisilicon/reset.c
index 93cee17db8b1..c3b7daac9313 100644
--- a/drivers/clk/hisilicon/reset.c
+++ b/drivers/clk/hisilicon/reset.c
@@ -91,7 +91,7 @@ struct hisi_reset_controller *hisi_reset_init(struct platform_device *pdev)
{
struct hisi_reset_controller *rstc;
- rstc = devm_kmalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL);
+ rstc = devm_kzalloc(&pdev->dev, sizeof(*rstc), GFP_KERNEL);
if (!rstc)
return NULL;
--
2.47.3
next reply other threads:[~2026-02-24 2:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 2:19 Shawn Guo [this message]
2026-02-25 22:39 ` [PATCH] clk: hisilicon: reset: Use kzalloc instead of kmalloc Brian Masney
2026-02-26 8:33 ` Philipp Zabel
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=20260224021912.54365-1-shawnguo@kernel.org \
--to=shawnguo@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=sboyd@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