mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 01:53:29 +02:00
clk: davinci: Add NULL check in davinci_lpsc_clk_register()
devm_kasprintf() returns NULL when memory allocation fails. Currently,
davinci_lpsc_clk_register() does not check for this case, which results
in a NULL pointer dereference.
Add NULL check after devm_kasprintf() to prevent this issue and ensuring
no resources are left allocated.
Fixes: c6ed4d734b ("clk: davinci: New driver for davinci PSC clocks")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Link: https://lore.kernel.org/r/20250401131341.26800-1-bsdhenrymartin@gmail.com
Reviewed-by: David Lechner <david@lechnology.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
This commit is contained in:
parent
2c9891e958
commit
13de464f44
|
|
@ -277,6 +277,11 @@ davinci_lpsc_clk_register(struct device *dev, const char *name,
|
|||
|
||||
lpsc->pm_domain.name = devm_kasprintf(dev, GFP_KERNEL, "%s: %s",
|
||||
best_dev_name(dev), name);
|
||||
if (!lpsc->pm_domain.name) {
|
||||
clk_hw_unregister(&lpsc->hw);
|
||||
kfree(lpsc);
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
lpsc->pm_domain.attach_dev = davinci_psc_genpd_attach_dev;
|
||||
lpsc->pm_domain.detach_dev = davinci_psc_genpd_detach_dev;
|
||||
lpsc->pm_domain.flags = GENPD_FLAG_PM_CLK;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user