lkml.org 
[lkml]   [2022]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] firmware: arm_scpi: Fix error handle when scpi probe failed
On Fri, Jul 01, 2022 at 10:42:12AM +0100, Sudeep Holla wrote:
> diff --git i/drivers/firmware/arm_scpi.c w/drivers/firmware/arm_scpi.c
> index ddf0b9ff9e15..6fa1a5b193b8 100644
> --- i/drivers/firmware/arm_scpi.c
> +++ w/drivers/firmware/arm_scpi.c
> @@ -799,7 +799,7 @@ static struct scpi_ops scpi_ops = {
>
> struct scpi_ops *get_scpi_ops(void)
> {
> - return scpi_info ? scpi_info->scpi_ops : NULL;
> + return scpi_info && scpi_info->scpi_ops ? scpi_info->scpi_ops : NULL;

Scratch that, scpi_info->scpi_ops will be NULL and it is fine to return NULL.

Only reason why something can go wrong is if devm_of_platform_populate()
fails and we return error after setting up scpi_info->scpi_ops.

Can you check if the below fixes the issue ? We can continue working as
a driver even if few of the devices were populated which could be the case
but I am still doubtful about that.

Regards,
Sudeep

-->8

diff --git i/drivers/firmware/arm_scpi.c w/drivers/firmware/arm_scpi.c
index ddf0b9ff9e15..bae2e18e24ee 100644
--- i/drivers/firmware/arm_scpi.c
+++ w/drivers/firmware/arm_scpi.c
@@ -1024,7 +1024,9 @@ static int scpi_probe(struct platform_device *pdev)
scpi_info->firmware_version));
scpi_info->scpi_ops = &scpi_ops;

- return devm_of_platform_populate(dev);
+ devm_of_platform_populate(dev);
+
+ return ret;
}

\
 
 \ /
  Last update: 2022-07-01 12:01    [W:0.080 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site