2017-11-19 03:13:10

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 2/3] mfd: intel-lpss: Handle return value of platform_get_*

platform_get_irq() and platform_get_resource() can fail here and
we must check its return value.

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/mfd/intel-lpss-acpi.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index 7911b0a..cb84de5 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -92,6 +92,8 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev)

info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
info->irq = platform_get_irq(pdev, 0);
+ if (!info->mem || info->irq < 0)
+ return -ENOMEM;

pm_runtime_set_active(&pdev->dev);
pm_runtime_enable(&pdev->dev);
--
2.7.4


From 1585610868511656573@xxx Fri Dec 01 19:26:01 +0000 2017
X-GM-THRID: 1585610868511656573
X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread