* [PATCH 1/1] dm: simplify uclass_pre_remove_device
@ 2023-03-18 9:55 Heinrich Schuchardt
2023-03-18 20:20 ` Simon Glass
0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2023-03-18 9:55 UTC (permalink / raw)
To: Simon Glass; +Cc: u-boot, Heinrich Schuchardt
Remove a superfluous logical constraint.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
---
drivers/core/uclass.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] dm: simplify uclass_pre_remove_device
2023-03-18 9:55 [PATCH 1/1] dm: simplify uclass_pre_remove_device Heinrich Schuchardt
@ 2023-03-18 20:20 ` Simon Glass
0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2023-03-18 20:20 UTC (permalink / raw)
To: Heinrich Schuchardt; +Cc: u-boot
Hi Heinrich,
On Sat, 18 Mar 2023 at 03:56, Heinrich Schuchardt
<heinrich.schuchardt@canonical.com> wrote:
>
> Remove a superfluous logical constraint.
>
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-18 20:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-18 9:55 [PATCH 1/1] dm: simplify uclass_pre_remove_device Heinrich Schuchardt
2023-03-18 20:20 ` Simon Glass
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.