mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Felix Gu <ustc.gu@gmail.com>
To: Ryan Chen <ryan_chen@aspeedtech.com>,
	Joel Stanley <joel@jms.id.au>,
	 Michael Turquette <mturquette@baylibre.com>,
	 Stephen Boyd <sboyd@kernel.org>,
	 Andrew Jeffery <andrew@codeconstruct.com.au>,
	 Brian Masney <bmasney@redhat.com>
Cc: linux-clk@vger.kernel.org, linux-aspeed@lists.ozlabs.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,  Felix Gu <ustc.gu@gmail.com>
Subject: [PATCH] clk: aspeed: ast2700: Add missing NULL pointer check for devm_kasprintf()
Date: Wed, 18 Feb 2026 16:16:37 +0800	[thread overview]
Message-ID: <20260218-ast2700-v1-1-2388e0fe3597@gmail.com> (raw)

devm_kasprintf() can return NULL on memory allocation failure.

Check the return value and return -ENOMEM if allocation fails in
ast2700_soc_clk_probe().

Fixes: fdc1eb624ddc ("clk: aspeed: add AST2700 clock driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/clk/aspeed/clk-ast2700.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/aspeed/clk-ast2700.c b/drivers/clk/aspeed/clk-ast2700.c
index bbb2b571eb72..011f8be03edc 100644
--- a/drivers/clk/aspeed/clk-ast2700.c
+++ b/drivers/clk/aspeed/clk-ast2700.c
@@ -901,6 +901,8 @@ static int ast2700_soc_clk_probe(struct platform_device *pdev)
 
 	clk_ctrl->clk_data = clk_data;
 	reset_name = devm_kasprintf(dev, GFP_KERNEL, "reset%d", clk_data->scu);
+	if (!reset_name)
+		return -ENOMEM;
 
 	clk_hw_data = devm_kzalloc(dev, struct_size(clk_hw_data, hws, clk_data->nr_clks),
 				   GFP_KERNEL);

---
base-commit: fe9e3edb6a215515d1148d32a5c445c5bdd7916f
change-id: 20260218-ast2700-6cf87db729f0

Best regards,
-- 
Felix Gu <ustc.gu@gmail.com>


             reply	other threads:[~2026-02-18  8:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-18  8:16 Felix Gu [this message]
2026-02-18 11:14 ` Brian Masney
2026-02-23  0:34   ` Ryan Chen

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=20260218-ast2700-v1-1-2388e0fe3597@gmail.com \
    --to=ustc.gu@gmail.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=bmasney@redhat.com \
    --cc=joel@jms.id.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=ryan_chen@aspeedtech.com \
    --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

all inboxes | Powered by JetHome®