diff options
author | Wells Lu | 2023-05-28 20:34:37 +0800 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-07-19 16:21:37 +0200 |
commit | fc45a8be5e5289439ac9b0b3795d709baff04bf1 (patch) | |
tree | c543bde2a92da3352197f0d46cbb48a3331e68af /drivers/pinctrl | |
parent | 8362ea6158038d84b33699dd18032beb3c522479 (diff) |
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>
Diffstat (limited to 'drivers/pinctrl')
-rw-r--r-- | drivers/pinctrl/sunplus/sppctl.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/pinctrl/sunplus/sppctl.c b/drivers/pinctrl/sunplus/sppctl.c index 0449595b943c..6b24fa0e63c0 100644 --- a/drivers/pinctrl/sunplus/sppctl.c +++ b/drivers/pinctrl/sunplus/sppctl.c @@ -975,8 +975,7 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node sppctl_map_err: for (i = 0; i < (*num_maps); i++) - if (((*map)[i].type == PIN_MAP_TYPE_CONFIGS_PIN) && - (*map)[i].data.configs.configs) + if ((*map)[i].type == PIN_MAP_TYPE_CONFIGS_PIN) kfree((*map)[i].data.configs.configs); kfree(*map); of_node_put(parent); |