linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: intel-lpss: Add missing check for platform_get_resource
@ 2023-05-31 10:02 Jiasheng Jiang
  2023-06-08 17:14 ` Lee Jones
  0 siblings, 1 reply; 2+ messages in thread
From: Jiasheng Jiang @ 2023-05-31 10:02 UTC (permalink / raw)
  To: lee; +Cc: linux-kernel, Jiasheng Jiang

Add the missing check for platform_get_resource and return error
if it fails.

Fixes: 4b45efe85263 ("mfd: Add support for Intel Sunrisepoint LPSS devices")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
 drivers/mfd/intel-lpss-acpi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
index a143c8dca2d9..1a6ebd3d9795 100644
--- a/drivers/mfd/intel-lpss-acpi.c
+++ b/drivers/mfd/intel-lpss-acpi.c
@@ -183,6 +183,9 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!info->mem)
+		return -ENOMEM;
+
 	info->irq = platform_get_irq(pdev, 0);
 
 	ret = intel_lpss_probe(&pdev->dev, info);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mfd: intel-lpss: Add missing check for platform_get_resource
  2023-05-31 10:02 [PATCH] mfd: intel-lpss: Add missing check for platform_get_resource Jiasheng Jiang
@ 2023-06-08 17:14 ` Lee Jones
  0 siblings, 0 replies; 2+ messages in thread
From: Lee Jones @ 2023-06-08 17:14 UTC (permalink / raw)
  To: Jiasheng Jiang; +Cc: linux-kernel

On Wed, 31 May 2023, Jiasheng Jiang wrote:

> Add the missing check for platform_get_resource and return error
> if it fails.
> 
> Fixes: 4b45efe85263 ("mfd: Add support for Intel Sunrisepoint LPSS devices")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
>  drivers/mfd/intel-lpss-acpi.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c
> index a143c8dca2d9..1a6ebd3d9795 100644
> --- a/drivers/mfd/intel-lpss-acpi.c
> +++ b/drivers/mfd/intel-lpss-acpi.c
> @@ -183,6 +183,9 @@ static int intel_lpss_acpi_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!info->mem)
> +		return -ENOMEM;

This does not mean we're out of memory.

Please use either -EINVAL or -ENODEV.

> +
>  	info->irq = platform_get_irq(pdev, 0);
>  
>  	ret = intel_lpss_probe(&pdev->dev, info);
> -- 
> 2.25.1
> 

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-08 17:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31 10:02 [PATCH] mfd: intel-lpss: Add missing check for platform_get_resource Jiasheng Jiang
2023-06-08 17:14 ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).