]> git.hungrycats.org Git - linux/commit
pinctrl:sunplus: Add check for kmalloc
authorWells Lu <wellslutw@gmail.com>
Sun, 28 May 2023 12:34:37 +0000 (20:34 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jul 2023 17:39:47 +0000 (19:39 +0200)
commita6fad96eccf8f6f8ae24f4a9b022f090a9b33d15
tree5fca26990558607ccc8fcad5d4c85817f0f68e4c
parent43ccb94c2e48a7484657170e6f5245db7c8eb7c3
pinctrl:sunplus: Add check for kmalloc

[ Upstream commit 73f8ce7f961afcb3be49352efeb7c26cc1c00cc4 ]

Fix Smatch static checker warning:
potential null dereference 'configs'. (kmalloc returns null)

Changes in v2:
1. Add free allocated memory before returned -ENOMEM.
2. Add call of_node_put() before returned -ENOMEM.

Fixes: aa74c44be19c ("pinctrl: Add driver for Sunplus SP7021")
Signed-off-by: Wells Lu <wellslutw@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/1685277277-12209-1-git-send-email-wellslutw@gmail.com
[Rebased on the patch from Lu Hongfei]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/sunplus/sppctl.c