Linux-OMAP Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] clk/ti/adpll: Add a NULL check for devm_kasprintf()
@ 2020-05-18  3:46 Xu Wang
  2020-05-18  3:55 ` Joe Perches
  2020-05-27 12:20 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: Xu Wang @ 2020-05-18  3:46 UTC (permalink / raw)
  To: t-kristo, mturquette, sboyd, linux-omap, linux-clk; +Cc: linux-kernel

devm_kasprintf() may fail, so we should better add a NULL check
and propagate an error on failure.

Signed-off-by: Xu Wang <vulab@iscas.ac.cn>
---
 drivers/clk/ti/adpll.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/ti/adpll.c b/drivers/clk/ti/adpll.c
index bb2f283..f18a672 100644
--- a/drivers/clk/ti/adpll.c
+++ b/drivers/clk/ti/adpll.c
@@ -196,6 +196,8 @@ static const char *ti_adpll_clk_get_name(struct ti_adpll_data *d,
 	} else {
 		name = devm_kasprintf(d->dev, GFP_KERNEL, "%08lx.adpll.%s",
 				      d->pa, postfix);
+		if (!name)
+			return -ENOMEM;
 	}
 
 	return name;
-- 
2.7.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18  3:46 [PATCH] clk/ti/adpll: Add a NULL check for devm_kasprintf() Xu Wang
2020-05-18  3:55 ` Joe Perches
2020-05-27 12:20 ` kbuild test robot

Linux-OMAP Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-omap/0 linux-omap/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-omap linux-omap/ https://lore.kernel.org/linux-omap \
		linux-omap@vger.kernel.org
	public-inbox-index linux-omap

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-omap


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git