* [PATCH] pinctrl: intel: Assume 0 by default for PNP UID
@ 2021-12-04 3:04 Kai-Heng Feng
2021-12-04 12:49 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Kai-Heng Feng @ 2021-12-04 3:04 UTC (permalink / raw)
To: mika.westerberg, andy
Cc: Kai-Heng Feng, Linus Walleij, linux-gpio, linux-kernel
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@canonical.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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: intel: Assume 0 by default for PNP UID
2021-12-04 3:04 [PATCH] pinctrl: intel: Assume 0 by default for PNP UID Kai-Heng Feng
@ 2021-12-04 12:49 ` Andy Shevchenko
2021-12-07 3:48 ` Kai-Heng Feng
0 siblings, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2021-12-04 12:49 UTC (permalink / raw)
To: Kai-Heng Feng
Cc: mika.westerberg, andy, Linus Walleij, linux-gpio, linux-kernel
On Saturday, December 4, 2021, Kai-Heng Feng
<kai.heng.feng@canonical.com> wrote:
>
> 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.
Do you have updated firmware?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: intel: Assume 0 by default for PNP UID
2021-12-04 12:49 ` Andy Shevchenko
@ 2021-12-07 3:48 ` Kai-Heng Feng
2021-12-07 10:34 ` Andy Shevchenko
0 siblings, 1 reply; 4+ messages in thread
From: Kai-Heng Feng @ 2021-12-07 3:48 UTC (permalink / raw)
To: Andy Shevchenko
Cc: mika.westerberg, andy, Linus Walleij, linux-gpio, linux-kernel
On Sat, Dec 4, 2021 at 8:49 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Saturday, December 4, 2021, Kai-Heng Feng
> <kai.heng.feng@canonical.com> wrote:
> >
> > 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.
>
> Do you have updated firmware?
Customer confirmed new code drop from Intel does have _UID defined.
So I guess this patch is not needed anymore?
Kai-Heng
>
>
> --
> With Best Regards,
> Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] pinctrl: intel: Assume 0 by default for PNP UID
2021-12-07 3:48 ` Kai-Heng Feng
@ 2021-12-07 10:34 ` Andy Shevchenko
0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2021-12-07 10:34 UTC (permalink / raw)
To: Kai-Heng Feng
Cc: mika.westerberg, andy, Linus Walleij, linux-gpio, linux-kernel
On Tue, Dec 07, 2021 at 11:48:23AM +0800, Kai-Heng Feng wrote:
> On Sat, Dec 4, 2021 at 8:49 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> > On Saturday, December 4, 2021, Kai-Heng Feng
> > <kai.heng.feng@canonical.com> wrote:
> > >
> > > 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.
> >
> > Do you have updated firmware?
>
> Customer confirmed new code drop from Intel does have _UID defined.
> So I guess this patch is not needed anymore?
It is not, this is the idea, thanks for confirming!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-12-07 10:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 3:04 [PATCH] pinctrl: intel: Assume 0 by default for PNP UID Kai-Heng Feng
2021-12-04 12:49 ` Andy Shevchenko
2021-12-07 3:48 ` Kai-Heng Feng
2021-12-07 10:34 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.