[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211204030452.1482507-1-kai.heng.feng@canonical.com>
Date: Sat, 4 Dec 2021 11:04:52 +0800
From: Kai-Heng Feng <kai.heng.feng@...onical.com>
To: mika.westerberg@...ux.intel.com, andy@...nel.org
Cc: Kai-Heng Feng <kai.heng.feng@...onical.com>,
Linus Walleij <linus.walleij@...aro.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] pinctrl: intel: Assume 0 by default for PNP UID
There's an EHL board that the DSDT doesn't have _UID for pinctrl device,
and that causes a NULL pointer dereference in strcmp().
So in the absence of _UID, assume it's 0 by default to avoid the issue
and get a pinmap.
Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com>
---
drivers/pinctrl/intel/pinctrl-intel.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 85750974d1825..fbbff6d1683c2 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -1602,14 +1602,16 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_
const struct intel_pinctrl_soc_data **table;
struct acpi_device *adev;
unsigned int i;
+ char *uid;
adev = ACPI_COMPANION(&pdev->dev);
if (adev) {
const void *match = device_get_match_data(&pdev->dev);
+ uid = adev->pnp.unique_id ?: "0";
table = (const struct intel_pinctrl_soc_data **)match;
for (i = 0; table[i]; i++) {
- if (!strcmp(adev->pnp.unique_id, table[i]->uid)) {
+ if (!strcmp(uid, table[i]->uid)) {
data = table[i];
break;
}
--
2.32.0
Powered by blists - more mailing lists