linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] firmware: arm_scmi: Fix to replace of_match_device
@ 2019-03-22 21:55 Aditya Pakki
  2019-03-25 11:08 ` Steven Price
  2019-04-10 16:10 ` Sudeep Holla
  0 siblings, 2 replies; 3+ messages in thread
From: Aditya Pakki @ 2019-03-22 21:55 UTC (permalink / raw)
  To: pakki001; +Cc: kjlu, Sudeep Holla, linux-arm-kernel, linux-kernel

of_match_device can return NULL if no matching device is found.
This patch replaces the function with of_device_get_match_data.
and returns -EINVAL in such a scenario.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>

---
v1: Replace of_match_device with of_device_get_match_data
---
 drivers/firmware/arm_scmi/driver.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 8f952f2f1a29..a44852a1d5bc 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -798,7 +798,9 @@ static int scmi_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	desc = of_match_device(scmi_of_match, dev)->data;
+	desc = of_device_get_match_data(dev);
+	if (!desc)
+		return -EINVAL;
 
 	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
 	if (!info)
-- 
2.17.1


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

* Re: [PATCH v2] firmware: arm_scmi: Fix to replace of_match_device
  2019-03-22 21:55 [PATCH v2] firmware: arm_scmi: Fix to replace of_match_device Aditya Pakki
@ 2019-03-25 11:08 ` Steven Price
  2019-04-10 16:10 ` Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Steven Price @ 2019-03-25 11:08 UTC (permalink / raw)
  To: Aditya Pakki; +Cc: kjlu, linux-kernel, linux-arm-kernel, Sudeep Holla

On 22/03/2019 21:55, Aditya Pakki wrote:
> of_match_device can return NULL if no matching device is found.
> This patch replaces the function with of_device_get_match_data.
> and returns -EINVAL in such a scenario.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>

Reviewed-by: Steven Price <steven.price@arm.com>

> 
> ---
> v1: Replace of_match_device with of_device_get_match_data
> ---
>  drivers/firmware/arm_scmi/driver.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index 8f952f2f1a29..a44852a1d5bc 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -798,7 +798,9 @@ static int scmi_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>  
> -	desc = of_match_device(scmi_of_match, dev)->data;
> +	desc = of_device_get_match_data(dev);
> +	if (!desc)
> +		return -EINVAL;
>  
>  	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
>  	if (!info)
> 


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

* Re: [PATCH v2] firmware: arm_scmi: Fix to replace of_match_device
  2019-03-22 21:55 [PATCH v2] firmware: arm_scmi: Fix to replace of_match_device Aditya Pakki
  2019-03-25 11:08 ` Steven Price
@ 2019-04-10 16:10 ` Sudeep Holla
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2019-04-10 16:10 UTC (permalink / raw)
  To: Aditya Pakki; +Cc: kjlu, linux-arm-kernel, linux-kernel, Sudeep Holla

On Fri, Mar 22, 2019 at 04:55:03PM -0500, Aditya Pakki wrote:
> of_match_device can return NULL if no matching device is found.
> This patch replaces the function with of_device_get_match_data.
> and returns -EINVAL in such a scenario.
>
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
>
> ---
> v1: Replace of_match_device with of_device_get_match_data
> ---
>  drivers/firmware/arm_scmi/driver.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index 8f952f2f1a29..a44852a1d5bc 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -798,7 +798,9 @@ static int scmi_probe(struct platform_device *pdev)
>  		return -EINVAL;
>  	}
>
> -	desc = of_match_device(scmi_of_match, dev)->data;

probe won't be called be there's no match. And we mandate data in the
driver, so this should never happen.

> +	desc = of_device_get_match_data(dev);

Having said that, I am happy to use the above function.

> +	if (!desc)
> +		return -EINVAL;
>

NULL check seems totally unnecessary, but it's in probe so I am fine.
Applied with updates to subject and commit message.

--
Regards,
Sudeep

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

end of thread, other threads:[~2019-04-10 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 21:55 [PATCH v2] firmware: arm_scmi: Fix to replace of_match_device Aditya Pakki
2019-03-25 11:08 ` Steven Price
2019-04-10 16:10 ` Sudeep Holla

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).