[PATCH] pinctrl: aspeed: fix null dereference in debug
Weiguo Li
liwg06 at foxmail.com
Wed Mar 2 06:30:54 AEDT 2022
"pdesc" is null checked, but already dereferenced ahead in debug.
Swap their positions to avoid potential null dereference.
Signed-off-by: Weiguo Li <liwg06 at foxmail.com>
---
drivers/pinctrl/aspeed/pinctrl-aspeed.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/aspeed/pinctrl-aspeed.c b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
index c94e24aadf92..83d47ff1cea8 100644
--- a/drivers/pinctrl/aspeed/pinctrl-aspeed.c
+++ b/drivers/pinctrl/aspeed/pinctrl-aspeed.c
@@ -236,11 +236,11 @@ int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
const struct aspeed_sig_expr **funcs;
const struct aspeed_sig_expr ***prios;
- pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
-
if (!pdesc)
return -EINVAL;
+ pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
+
prios = pdesc->prios;
if (!prios)
--
2.25.1
More information about the Linux-aspeed
mailing list