]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sysreset: Fix unsupported request return values
authorPaul Barker <paul.barker.ct@bp.renesas.com>
Wed, 8 Nov 2023 08:51:10 +0000 (08:51 +0000)
committerTom Rini <trini@konsulko.com>
Thu, 16 Nov 2023 23:53:09 +0000 (18:53 -0500)
The description of the sysreset request method in <sysreset.h> says that
the return value should be -EPROTONOSUPPORT if the requested reset type
is not supported by this device.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
drivers/sysreset/poweroff_gpio.c
drivers/sysreset/sysreset_psci.c
drivers/sysreset/sysreset_sandbox.c
drivers/sysreset/sysreset_watchdog.c
drivers/sysreset/sysreset_x86.c
test/dm/sysreset.c

index a5c24fd85bca9734261bc5a065dc22ad52ba2df8..ad04e4b1a85eee0359b156f292bc697e8982cd0e 100644 (file)
@@ -33,7 +33,7 @@ static int poweroff_gpio_request(struct udevice *dev, enum sysreset_t type)
        int r;
 
        if (type != SYSRESET_POWER_OFF)
-               return -ENOSYS;
+               return -EPROTONOSUPPORT;
 
        debug("GPIO poweroff\n");
 
index a8a41528a849304ca8ecfb7e604332f06991a96e..aa09d0b88271bff312ab1c38d15bb435ef7f4528 100644 (file)
@@ -25,7 +25,7 @@ static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type)
                psci_sys_poweroff();
                break;
        default:
-               return -ENOSYS;
+               return -EPROTONOSUPPORT;
        }
 
        return -EINPROGRESS;
index f485a135299370bf7e504fd3b657c9749373a73f..c12eda81d03e7d6b96c6104c2005b554b664ac7b 100644 (file)
@@ -21,7 +21,7 @@ static int sandbox_warm_sysreset_request(struct udevice *dev,
                state->last_sysreset = type;
                break;
        default:
-               return -ENOSYS;
+               return -EPROTONOSUPPORT;
        }
        if (!state->sysreset_allowed[type])
                return -EACCES;
@@ -70,7 +70,7 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
                        return -EACCES;
                sandbox_exit();
        default:
-               return -ENOSYS;
+               return -EPROTONOSUPPORT;
        }
        if (!state->sysreset_allowed[type])
                return -EACCES;
index ceada2e47b547045d1f7761276ac92bdb8021f79..6db5aa75b54173e73994df5b9b31dfaf7291fed6 100644 (file)
@@ -29,7 +29,7 @@ static int wdt_reboot_request(struct udevice *dev, enum sysreset_t type)
                        return ret;
                break;
        default:
-               return -ENOSYS;
+               return -EPROTONOSUPPORT;
        }
 
        return -EINPROGRESS;
index 4936fdb76c721426272c0a6d6ae36e7ea308e7e9..dc772b5ff9e34a5e80df503df9f49270e73a147f 100644 (file)
@@ -87,7 +87,7 @@ static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
                        return ret;
                return -EINPROGRESS;
        default:
-               return -ENOSYS;
+               return -EPROTONOSUPPORT;
        }
 
        outb(value, IO_PORT_RESET);
index 691683c567400a119c541160cb2d942c67023dcd..5aa69e046186a33af5406e1e38e0085969647144 100644 (file)
@@ -27,8 +27,8 @@ static int dm_test_sysreset_base(struct unit_test_state *uts)
        /* Device 1 is the warm sysreset device */
        ut_assertok(uclass_get_device(UCLASS_SYSRESET, 1, &dev));
        ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_WARM));
-       ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_COLD));
-       ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_POWER));
+       ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_COLD));
+       ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_POWER));
 
        state->sysreset_allowed[SYSRESET_WARM] = true;
        ut_asserteq(-EINPROGRESS, sysreset_request(dev, SYSRESET_WARM));
@@ -36,7 +36,7 @@ static int dm_test_sysreset_base(struct unit_test_state *uts)
 
        /* Device 2 is the cold sysreset device */
        ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev));
-       ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_WARM));
+       ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_WARM));
        state->sysreset_allowed[SYSRESET_COLD] = false;
        ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_COLD));
        state->sysreset_allowed[SYSRESET_COLD] = true;