All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus
@ 2021-06-24  9:50 Sudeep Holla
  2021-06-24  9:50 ` [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function Sudeep Holla
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Sudeep Holla @ 2021-06-24  9:50 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Sudeep Holla, Cristian Marussi, Uwe Kleine-König

When the driver core calls the probe callback it already checked that
the devices match, so there is no need to call the match callback again.

Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/bus.c | 5 -----
 1 file changed, 5 deletions(-)

Hi Uwe,

Just remembered the similarity in SCMI when you posted similar patches
for Arm FF-A. Thought I will push this out before I forget. I have put
suggested and reported by you as I don't have upstream commit id to refer
yet. Hope that is fine.

Regards,
Sudeep

diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index 784cf0027da3..dc113ad37ad9 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -104,11 +104,6 @@ static int scmi_dev_probe(struct device *dev)
 {
 	struct scmi_driver *scmi_drv = to_scmi_driver(dev->driver);
 	struct scmi_device *scmi_dev = to_scmi_dev(dev);
-	const struct scmi_device_id *id;
-
-	id = scmi_dev_match_id(scmi_dev, scmi_drv);
-	if (!id)
-		return -ENODEV;
 
 	if (!scmi_dev->handle)
 		return -EPROBE_DEFER;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function
  2021-06-24  9:50 [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus Sudeep Holla
@ 2021-06-24  9:50 ` Sudeep Holla
  2021-06-24 10:08   ` Cristian Marussi
  2021-06-24 19:54   ` Uwe Kleine-König
  2021-06-24 10:08 ` [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus Cristian Marussi
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 7+ messages in thread
From: Sudeep Holla @ 2021-06-24  9:50 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: Sudeep Holla, Cristian Marussi, Uwe Kleine-König

The bus probe callback calls the driver callback without further
checking. Better be safe than sorry and refuse registration of a driver
without a probe function to prevent a NULL pointer exception.

Fixes: 933c504424a2 ("firmware: arm_scmi: add scmi protocol bus to enumerate protocol devices")
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/bus.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index dc113ad37ad9..6c7e24935eca 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -134,6 +134,9 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner,
 {
 	int retval;
 
+	if (!driver->probe)
+		return -EINVAL;
+
 	retval = scmi_protocol_device_request(driver->id_table);
 	if (retval)
 		return retval;
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus
  2021-06-24  9:50 [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus Sudeep Holla
  2021-06-24  9:50 ` [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function Sudeep Holla
@ 2021-06-24 10:08 ` Cristian Marussi
  2021-06-24 19:54 ` Uwe Kleine-König
  2021-06-25 10:20 ` Sudeep Holla
  3 siblings, 0 replies; 7+ messages in thread
From: Cristian Marussi @ 2021-06-24 10:08 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-arm-kernel, Uwe Kleine-König

Hi,

On Thu, Jun 24, 2021 at 10:50:58AM +0100, Sudeep Holla wrote:
> When the driver core calls the probe callback it already checked that
> the devices match, so there is no need to call the match callback again.
> 
> Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_scmi/bus.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> Hi Uwe,
> 
> Just remembered the similarity in SCMI when you posted similar patches
> for Arm FF-A. Thought I will push this out before I forget. I have put
> suggested and reported by you as I don't have upstream commit id to refer
> yet. Hope that is fine.
> 
> Regards,
> Sudeep
> 
> diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
> index 784cf0027da3..dc113ad37ad9 100644
> --- a/drivers/firmware/arm_scmi/bus.c
> +++ b/drivers/firmware/arm_scmi/bus.c
> @@ -104,11 +104,6 @@ static int scmi_dev_probe(struct device *dev)
>  {
>  	struct scmi_driver *scmi_drv = to_scmi_driver(dev->driver);
>  	struct scmi_device *scmi_dev = to_scmi_dev(dev);
> -	const struct scmi_device_id *id;
> -
> -	id = scmi_dev_match_id(scmi_dev, scmi_drv);
> -	if (!id)
> -		return -ENODEV;
>  
>  	if (!scmi_dev->handle)
>  		return -EPROBE_DEFER;

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian

> -- 
> 2.25.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function
  2021-06-24  9:50 ` [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function Sudeep Holla
@ 2021-06-24 10:08   ` Cristian Marussi
  2021-06-24 19:54   ` Uwe Kleine-König
  1 sibling, 0 replies; 7+ messages in thread
From: Cristian Marussi @ 2021-06-24 10:08 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-arm-kernel, Uwe Kleine-König

Hi,

On Thu, Jun 24, 2021 at 10:50:59AM +0100, Sudeep Holla wrote:
> The bus probe callback calls the driver callback without further
> checking. Better be safe than sorry and refuse registration of a driver
> without a probe function to prevent a NULL pointer exception.
> 
> Fixes: 933c504424a2 ("firmware: arm_scmi: add scmi protocol bus to enumerate protocol devices")
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_scmi/bus.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
> index dc113ad37ad9..6c7e24935eca 100644
> --- a/drivers/firmware/arm_scmi/bus.c
> +++ b/drivers/firmware/arm_scmi/bus.c
> @@ -134,6 +134,9 @@ int scmi_driver_register(struct scmi_driver *driver, struct module *owner,
>  {
>  	int retval;
>  
> +	if (!driver->probe)
> +		return -EINVAL;
> +
>  	retval = scmi_protocol_device_request(driver->id_table);
>  	if (retval)
>  		return retval;

Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Tested-by: Cristian Marussi <cristian.marussi@arm.com>

Thanks,
Cristian


> -- 
> 2.25.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus
  2021-06-24  9:50 [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus Sudeep Holla
  2021-06-24  9:50 ` [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function Sudeep Holla
  2021-06-24 10:08 ` [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus Cristian Marussi
@ 2021-06-24 19:54 ` Uwe Kleine-König
  2021-06-25 10:20 ` Sudeep Holla
  3 siblings, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2021-06-24 19:54 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-arm-kernel, Cristian Marussi


[-- Attachment #1.1: Type: text/plain, Size: 948 bytes --]

On Thu, Jun 24, 2021 at 10:50:58AM +0100, Sudeep Holla wrote:
> When the driver core calls the probe callback it already checked that
> the devices match, so there is no need to call the match callback again.
> 
> Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_scmi/bus.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> Hi Uwe,
> 
> Just remembered the similarity in SCMI when you posted similar patches
> for Arm FF-A. Thought I will push this out before I forget. I have put
> suggested and reported by you as I don't have upstream commit id to refer
> yet. Hope that is fine.

Sure.

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function
  2021-06-24  9:50 ` [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function Sudeep Holla
  2021-06-24 10:08   ` Cristian Marussi
@ 2021-06-24 19:54   ` Uwe Kleine-König
  1 sibling, 0 replies; 7+ messages in thread
From: Uwe Kleine-König @ 2021-06-24 19:54 UTC (permalink / raw)
  To: Sudeep Holla; +Cc: linux-arm-kernel, Cristian Marussi


[-- Attachment #1.1: Type: text/plain, Size: 789 bytes --]

On Thu, Jun 24, 2021 at 10:50:59AM +0100, Sudeep Holla wrote:
> The bus probe callback calls the driver callback without further
> checking. Better be safe than sorry and refuse registration of a driver
> without a probe function to prevent a NULL pointer exception.
> 
> Fixes: 933c504424a2 ("firmware: arm_scmi: add scmi protocol bus to enumerate protocol devices")
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Thanks to pick my "suggestion" up also for scmi.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus
  2021-06-24  9:50 [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus Sudeep Holla
                   ` (2 preceding siblings ...)
  2021-06-24 19:54 ` Uwe Kleine-König
@ 2021-06-25 10:20 ` Sudeep Holla
  3 siblings, 0 replies; 7+ messages in thread
From: Sudeep Holla @ 2021-06-25 10:20 UTC (permalink / raw)
  To: linux-arm-kernel, Sudeep Holla; +Cc: Cristian Marussi, Uwe Kleine-König

On Thu, 24 Jun 2021 10:50:58 +0100, Sudeep Holla wrote:
> When the driver core calls the probe callback it already checked that
> the devices match, so there is no need to call the match callback again.


Applied to sudeep.holla/linux (for-next/scmi), thanks!

[1/2] firmware: arm_scmi: Simplify device probe function on the bus
      https://git.kernel.org/sudeep.holla/c/113e793d18
[2/2] firmware: arm_scmi: Ensure drivers provide a probe function
      https://git.kernel.org/sudeep.holla/c/8ecab77009

--
Regards,
Sudeep


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-06-25 10:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  9:50 [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus Sudeep Holla
2021-06-24  9:50 ` [PATCH 2/2] firmware: arm_scmi: Ensure drivers provide a probe function Sudeep Holla
2021-06-24 10:08   ` Cristian Marussi
2021-06-24 19:54   ` Uwe Kleine-König
2021-06-24 10:08 ` [PATCH 1/2] firmware: arm_scmi: Simplify device probe function on the bus Cristian Marussi
2021-06-24 19:54 ` Uwe Kleine-König
2021-06-25 10:20 ` Sudeep Holla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.