Skip to content

Commit 0aa5369

Browse files
author
Linus Walleij
committed
pinctrl: realtek: Fix some NULL dereference warnings
Just inspecting the code doesn't convince me that this is a real issue, but the tools complain that it is so I will just handle it. Cc: Tzuyi Chang <tychang@realtek.com> Link: https://lore.kernel.org/oe-kbuild-all/202309270234.aJGlDE0P-lkp@intel.com/ Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20231006-fix-realtek-warnings-v1-2-09af253312ba@linaro.org
1 parent d48f8a6 commit 0aa5369

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

drivers/pinctrl/realtek/pinctrl-rtd.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,10 @@ static int rtd_pinctrl_set_one_mux(struct pinctrl_dev *pcdev,
165165
return 0;
166166

167167
if (!mux->functions) {
168-
dev_err(pcdev->dev, "No functions available for pin %s\n", mux->name);
168+
if (!mux->name)
169+
dev_err(pcdev->dev, "NULL pin has no functions\n");
170+
else
171+
dev_err(pcdev->dev, "No functions available for pin %s\n", mux->name);
169172
return -ENOTSUPP;
170173
}
171174

@@ -177,6 +180,11 @@ static int rtd_pinctrl_set_one_mux(struct pinctrl_dev *pcdev,
177180
return ret;
178181
}
179182

183+
if (!mux->name) {
184+
dev_err(pcdev->dev, "NULL pin provided for function %s\n", func_name);
185+
return -EINVAL;
186+
}
187+
180188
dev_err(pcdev->dev, "No function %s available for pin %s\n", func_name, mux->name);
181189

182190
return -EINVAL;

0 commit comments

Comments
 (0)