Hi Heinrich,
On Sat, 18 Mar 2023 at 03:56, Heinrich Schuchardt
<[email protected]> wrote:
>
> Remove a superfluous logical constraint.
>
> Signed-off-by: Heinrich Schuchardt <[email protected]>
> ---
> drivers/core/uclass.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
Where possible I like to keep the happy path clear, so that we always
exit with 0. I know this results in a little more code, but it does
not affect the compiler output. I think it makes it easier to see when
things pass or fail.
>
> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
> index 1762a0796d..dce5b46fc7 100644
> --- a/drivers/core/uclass.c
> +++ b/drivers/core/uclass.c
> @@ -789,14 +789,10 @@ int uclass_post_probe_device(struct udevice *dev)
> int uclass_pre_remove_device(struct udevice *dev)
> {
> struct uclass *uc;
> - int ret;
>
> uc = dev->uclass;
> - if (uc->uc_drv->pre_remove) {
> - ret = uc->uc_drv->pre_remove(dev);
> - if (ret)
> - return ret;
> - }
> + if (uc->uc_drv->pre_remove)
> + return uc->uc_drv->pre_remove(dev);
>
> return 0;
> }
> --
> 2.39.2
>
Regards,
Simon