lkml.org 
[lkml]   [2023]   [Oct]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH 2/2] 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>
---
drivers/pinctrl/realtek/pinctrl-rtd.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/realtek/pinctrl-rtd.c b/drivers/pinctrl/realtek/pinctrl-rtd.c
index bafe27face80..fc27e4f61be1 100644
--- a/drivers/pinctrl/realtek/pinctrl-rtd.c
+++ b/drivers/pinctrl/realtek/pinctrl-rtd.c
@@ -165,7 +165,10 @@ static int rtd_pinctrl_set_one_mux(struct pinctrl_dev *pcdev,
return 0;

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

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

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

return -EINVAL;
--
2.34.1

\
 
 \ /
  Last update: 2023-10-06 23:04    [W:0.030 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site