2021-07-14 01:13:45

by Finn Thain

[permalink] [raw]
Subject: Re: [PATCH v4 5/5] bus: Make remove callback return void

On Tue, 13 Jul 2021, Uwe Kleine-König wrote:

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

...

> diff --git a/drivers/nubus/bus.c b/drivers/nubus/bus.c
> index ad3d17c42e23..d9d04f27f89b 100644
> --- a/drivers/nubus/bus.c
> +++ b/drivers/nubus/bus.c
> @@ -29,14 +29,12 @@ static int nubus_device_probe(struct device *dev)
> return err;
> }
>
> -static int nubus_device_remove(struct device *dev)
> +static void nubus_device_remove(struct device *dev)
> {
> struct nubus_driver *ndrv = to_nubus_driver(dev->driver);
> - int err = -ENODEV;
>
> if (dev->driver && ndrv->remove)
> - err = ndrv->remove(to_nubus_board(dev));
> - return err;
> + ndrv->remove(to_nubus_board(dev));
> }
>
> struct bus_type nubus_bus_type = {

Acked-by: Finn Thain <[email protected]>