clk: microchip: check for null return of devm_kzalloc()
authorHui Tang <tanghui20@huawei.com>
Sat, 19 Nov 2022 05:48:58 +0000 (13:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:32:15 +0000 (13:32 +0100)
commit95e90bcc934fbfe6273974759233d09550948258
tree0aac741ce232e91e1434a07a42f3525651d121d3
parentd87f58c25447d2c2d25a0940e0876891da81a1b5
clk: microchip: check for null return of devm_kzalloc()

[ Upstream commit e2e6a217a84d09785848a82599729c9a41566e3a ]

Because of the possible failure of devm_kzalloc(), name might be NULL and
will cause null pointer dereference later.

Therefore, it might be better to check it and directly return -ENOMEM.

Fixes: d39fb172760e ("clk: microchip: add PolarFire SoC fabric clock support")
Signed-off-by: Hui Tang <tanghui20@huawei.com>
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
[claudiu.beznea: s/refrence/reference/, s/possilble/possible]
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20221119054858.178629-1-tanghui20@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/clk/microchip/clk-mpfs-ccc.c