Skip to content

Commit 73f8ce7

Browse files
wellslutwlinusw
authored andcommitted
pinctrl:sunplus: Add check for kmalloc
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: aa74c44 ("pinctrl: Add driver for Sunplus SP7021") Signed-off-by: Wells Lu <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] [Rebased on the patch from Lu Hongfei] Signed-off-by: Linus Walleij <[email protected]>
1 parent b2132af commit 73f8ce7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/pinctrl/sunplus/sppctl.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -971,8 +971,7 @@ static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node
971971

972972
sppctl_map_err:
973973
for (i = 0; i < (*num_maps); i++)
974-
if (((*map)[i].type == PIN_MAP_TYPE_CONFIGS_PIN) &&
975-
(*map)[i].data.configs.configs)
974+
if ((*map)[i].type == PIN_MAP_TYPE_CONFIGS_PIN)
976975
kfree((*map)[i].data.configs.configs);
977976
kfree(*map);
978977
of_node_put(parent);

0 commit comments

Comments
 (0)