[PATCH] bus: Make remove callback return void

Mauro Carvalho Chehab mchehab at kernel.org
Tue Jul 6 12:26:31 CEST 2021


Em Tue,  6 Jul 2021 11:50:37 +0200
Uwe Kleine-König <u.kleine-koenig at pengutronix.de> escreveu:

> The driver core ignores the return value of this callback because there
> is only little it can do when a device disappears.
> 
> This is the final bit of a long lasting cleanup quest where several
> buses were converted to also return void from their remove callback.
> Additionally some resource leaks were fixed that were caused by drivers
> returning an error code in the expectation that the driver won't go
> away.
> 
> With struct bus_type::remove returning void it's prevented that newly
> implemented buses return an ignored error code and so don't anticipate
> wrong expectations for driver authors.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
> ---
> Hello,
> 
> this patch depends on "PCI: endpoint: Make struct pci_epf_driver::remove
> return void" that is not yet applied, see
> https://lore.kernel.org/r/20210223090757.57604-1-u.kleine-koenig@pengutronix.de.
> 
> I tested it using allmodconfig on amd64 and arm, but I wouldn't be
> surprised if I still missed to convert a driver. So it would be great to
> get this into next early after the merge window closes.
> 
> I send this mail to all people that get_maintainer.pl emits for this
> patch. I wonder how many recipents will refuse this mail because of the
> long Cc: list :-)
> 
> Best regards
> Uwe
> 

> diff --git a/drivers/media/pci/bt8xx/bttv-gpio.c b/drivers/media/pci/bt8xx/bttv-gpio.c
> index b730225ca887..a2b18e2bed1b 100644
> --- a/drivers/media/pci/bt8xx/bttv-gpio.c
> +++ b/drivers/media/pci/bt8xx/bttv-gpio.c
> @@ -46,14 +46,13 @@ static int bttv_sub_probe(struct device *dev)
>  	return sub->probe ? sub->probe(sdev) : -ENODEV;
>  }
>  
> -static int bttv_sub_remove(struct device *dev)
> +static void bttv_sub_remove(struct device *dev)
>  {
>  	struct bttv_sub_device *sdev = to_bttv_sub_dev(dev);
>  	struct bttv_sub_driver *sub = to_bttv_sub_drv(dev->driver);
>  
>  	if (sub->remove)
>  		sub->remove(sdev);
> -	return 0;
>  }
>  

Acked-by: Mauro Carvalho Chehab <mchehab at kernel.org> # for drivers/media


Thanks,
Mauro


More information about the Alsa-devel mailing list