* [PATCH] mfd: intel-lpss: Add check for platform_get_irq
@ 2023-10-31 6:36 Chen Ni
2023-10-31 10:34 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2023-10-31 6:36 UTC (permalink / raw)
To: lee, andriy.shevchenko, mika.westerberg; +Cc: linux-kernel, Chen Ni
The platform_get_irq() might be failed and return a negative result.
So there should have an error handling code.
Fixes: 4b45efe85263 ("mfd: Add support for Intel Sunrisepoint LPSS devices")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/mfd/intel-lpss-acpi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 212818aef93e..42b14a80b989 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -186,7 +186,11 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev)
if (!info->mem)
return -ENODEV;
- info->irq = platform_get_irq(pdev, 0);
+ ret = platform_get_irq(pdev, 0);
+ if (ret < 0)
+ return ret;
+
+ info->irq = ret;
ret = intel_lpss_probe(&pdev->dev, info);
if (ret)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mfd: intel-lpss: Add check for platform_get_irq
2023-10-31 6:36 [PATCH] mfd: intel-lpss: Add check for platform_get_irq Chen Ni
@ 2023-10-31 10:34 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2023-10-31 10:34 UTC (permalink / raw)
To: Chen Ni; +Cc: lee, mika.westerberg, linux-kernel
On Tue, Oct 31, 2023 at 06:36:42AM +0000, Chen Ni wrote:
> The platform_get_irq() might be failed and return a negative result.
> So there should have an error handling code.
NAK.
Have you checked the implementation of intel_lpcc_probe()?
> Fixes: 4b45efe85263 ("mfd: Add support for Intel Sunrisepoint LPSS devices")
It does not fix anything, except maybe an error code.
Also it misses PCI counterpart.
...
That said, I would expect that in intel_lpss_probe() the unset / erroneous IRQ
(which actually shouldn't be checked against 0 at all) should be returned as is.
i.e.
if (!info || !info->mem || info->irq <= 0)
return -EINVAL;
be converted to
if (!info || !info->mem)
return -EINVAL;
if (info->irq < 0)
return info->irq;
That kind of patch I will accept.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-10-31 10:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-31 6:36 [PATCH] mfd: intel-lpss: Add check for platform_get_irq Chen Ni
2023-10-31 10:34 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox