]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: core: Correct error handling when event fails
authorSimon Glass <sjg@chromium.org>
Thu, 24 Aug 2023 19:55:35 +0000 (13:55 -0600)
committerTom Rini <trini@konsulko.com>
Fri, 25 Aug 2023 21:55:18 +0000 (17:55 -0400)
Follow the correct path in device_probe() when and event handler fails.
This avoids getting into a strange state where the device appears to be
activated but is not.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/core/device.c

index 6e26b64fb812ab6ef0251cdf42c62c01ca65ad33..60f8d6700ad417dd03c6d703a826c00c834f5f5d 100644 (file)
@@ -598,9 +598,10 @@ int device_probe(struct udevice *dev)
 
        ret = device_notify(dev, EVT_DM_POST_PROBE);
        if (ret)
-               return ret;
+               goto fail_event;
 
        return 0;
+fail_event:
 fail_uclass:
        if (device_remove(dev, DM_REMOVE_NORMAL)) {
                dm_warn("%s: Device '%s' failed to remove on error path\n",