LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bus: fsl-mc: Cope for unbound devices in fsl_mc_shutdown
@ 2025-12-09 11:59 Uwe Kleine-König
  2025-12-09 12:05 ` Christophe Leroy (CS GROUP)
  2025-12-15 18:04 ` Christophe Leroy (CS GROUP)
  0 siblings, 2 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2025-12-09 11:59 UTC (permalink / raw)
  To: Ioana Ciornei, Christophe Leroy (CS GROUP)
  Cc: Greg Kroah-Hartman, linuxppc-dev, linux-kernel

Other than a driver's shutdown callback the bus shutdown callback is
also called for unbound drivers. So check for the device being bound
before following the pointer to its driver.

Fixes: ef980bda574d ("bus: fsl-mc: Convert to bus callbacks")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,

I pointed out this issue a few days ago in the thread that resulted in
commit ef980bda574d, but didn't receive a reaction so far. Given that
ef980bda574d is contained in next, I guess it's time for a proper patch
to fix the issue. Here it is.

Best regards
Uwe

 drivers/bus/fsl-mc/fsl-mc-bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 6bc163d2ca49..c08c04047ae2 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -162,7 +162,7 @@ static void fsl_mc_shutdown(struct device *dev)
 	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
 	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
 
-	if (mc_drv->shutdown)
+	if (dev->driver && mc_drv->shutdown)
 		mc_drv->shutdown(mc_dev);
 }
 

base-commit: ef980bda574d3a2ebaa297def62f03d2222e6ef3
-- 
2.47.3



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

* Re: [PATCH] bus: fsl-mc: Cope for unbound devices in fsl_mc_shutdown
  2025-12-09 11:59 [PATCH] bus: fsl-mc: Cope for unbound devices in fsl_mc_shutdown Uwe Kleine-König
@ 2025-12-09 12:05 ` Christophe Leroy (CS GROUP)
  2025-12-09 14:44   ` Uwe Kleine-König
  2025-12-15 18:04 ` Christophe Leroy (CS GROUP)
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2025-12-09 12:05 UTC (permalink / raw)
  To: Uwe Kleine-König, Ioana Ciornei
  Cc: Greg Kroah-Hartman, linuxppc-dev, linux-kernel



Le 09/12/2025 à 12:59, Uwe Kleine-König a écrit :
> Other than a driver's shutdown callback the bus shutdown callback is
> also called for unbound drivers. So check for the device being bound
> before following the pointer to its driver.
> 
> Fixes: ef980bda574d ("bus: fsl-mc: Convert to bus callbacks")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> I pointed out this issue a few days ago in the thread that resulted in
> commit ef980bda574d, but didn't receive a reaction so far. Given that
> ef980bda574d is contained in next, I guess it's time for a proper patch
> to fix the issue. Here it is.

Thanks for the fixup.

Nobody reacted against what you pointed out a few days ago so I guess 
this fix is OK.

Unless you mind I will squash it into previous patch to avoid having to 
manage the Fixes: tag update when I rebase to 6.19rc1

Christophe

> 
> Best regards
> Uwe
> 
>   drivers/bus/fsl-mc/fsl-mc-bus.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
> index 6bc163d2ca49..c08c04047ae2 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-bus.c
> +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
> @@ -162,7 +162,7 @@ static void fsl_mc_shutdown(struct device *dev)
>   	struct fsl_mc_driver *mc_drv = to_fsl_mc_driver(dev->driver);
>   	struct fsl_mc_device *mc_dev = to_fsl_mc_device(dev);
>   
> -	if (mc_drv->shutdown)
> +	if (dev->driver && mc_drv->shutdown)
>   		mc_drv->shutdown(mc_dev);
>   }
>   
> 
> base-commit: ef980bda574d3a2ebaa297def62f03d2222e6ef3



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

* Re: [PATCH] bus: fsl-mc: Cope for unbound devices in fsl_mc_shutdown
  2025-12-09 12:05 ` Christophe Leroy (CS GROUP)
@ 2025-12-09 14:44   ` Uwe Kleine-König
  0 siblings, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2025-12-09 14:44 UTC (permalink / raw)
  To: Christophe Leroy (CS GROUP)
  Cc: Ioana Ciornei, Greg Kroah-Hartman, linuxppc-dev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

On Tue, Dec 09, 2025 at 01:05:50PM +0100, Christophe Leroy (CS GROUP) wrote:
> 
> 
> Le 09/12/2025 à 12:59, Uwe Kleine-König a écrit :
> > Other than a driver's shutdown callback the bus shutdown callback is
> > also called for unbound drivers. So check for the device being bound
> > before following the pointer to its driver.
> > 
> > Fixes: ef980bda574d ("bus: fsl-mc: Convert to bus callbacks")
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> > ---
> > Hello,
> > 
> > I pointed out this issue a few days ago in the thread that resulted in
> > commit ef980bda574d, but didn't receive a reaction so far. Given that
> > ef980bda574d is contained in next, I guess it's time for a proper patch
> > to fix the issue. Here it is.
> 
> Thanks for the fixup.
> 
> Nobody reacted against what you pointed out a few days ago so I guess this
> fix is OK.

Always the optimist, I think it means nobody bothered :-)

> Unless you mind I will squash it into previous patch to avoid having to
> manage the Fixes: tag update when I rebase to 6.19rc1

No objection from my side.

Best regards
Uwe

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

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

* Re: [PATCH] bus: fsl-mc: Cope for unbound devices in fsl_mc_shutdown
  2025-12-09 11:59 [PATCH] bus: fsl-mc: Cope for unbound devices in fsl_mc_shutdown Uwe Kleine-König
  2025-12-09 12:05 ` Christophe Leroy (CS GROUP)
@ 2025-12-15 18:04 ` Christophe Leroy (CS GROUP)
  1 sibling, 0 replies; 4+ messages in thread
From: Christophe Leroy (CS GROUP) @ 2025-12-15 18:04 UTC (permalink / raw)
  To: Ioana Ciornei, Uwe Kleine-König
  Cc: Christophe Leroy, Greg Kroah-Hartman, linuxppc-dev, linux-kernel


On Tue, 09 Dec 2025 12:59:47 +0100, Uwe Kleine-König wrote:
> Other than a driver's shutdown callback the bus shutdown callback is
> also called for unbound drivers. So check for the device being bound
> before following the pointer to its driver.
> 
> 

Applied, thanks!

[1/1] bus: fsl-mc: Cope for unbound devices in fsl_mc_shutdown
      (no commit info)

Best regards,
-- 
Christophe Leroy (CS GROUP) <chleroy@kernel.org>


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

end of thread, other threads:[~2025-12-15 18:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-09 11:59 [PATCH] bus: fsl-mc: Cope for unbound devices in fsl_mc_shutdown Uwe Kleine-König
2025-12-09 12:05 ` Christophe Leroy (CS GROUP)
2025-12-09 14:44   ` Uwe Kleine-König
2025-12-15 18:04 ` Christophe Leroy (CS GROUP)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox