Skip to content

Commit e7f2a44

Browse files
Florian Vaussardlinusw
authored andcommitted
pinctrl: do not init debugfs entries for unimplemented functionalities
Commit c420619 "pinctrl: pinconf: remove checks on ops->pin_config_get" removed the check on (ops != NULL) when performing pinconf_pins_show() or pinconf_groups_show(). As these entries are always enabled, even if pinconf is not supported, reading will result in an oops due to NULL ops. Instead of checking for ops, remove the corresponding debugfs entries if pinconf and/or pinmux are not implemented. Tested on OMAP3 (pinctrl-single). Cc: [email protected] Signed-off-by: Florian Vaussard <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
1 parent 7b320cb commit e7f2a44

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/pinctrl/core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1644,8 +1644,10 @@ static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
16441644
device_root, pctldev, &pinctrl_groups_ops);
16451645
debugfs_create_file("gpio-ranges", S_IFREG | S_IRUGO,
16461646
device_root, pctldev, &pinctrl_gpioranges_ops);
1647-
pinmux_init_device_debugfs(device_root, pctldev);
1648-
pinconf_init_device_debugfs(device_root, pctldev);
1647+
if (pctldev->desc->pmxops)
1648+
pinmux_init_device_debugfs(device_root, pctldev);
1649+
if (pctldev->desc->confops)
1650+
pinconf_init_device_debugfs(device_root, pctldev);
16491651
}
16501652

16511653
static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)

0 commit comments

Comments
 (0)