diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2024-09-05 15:16:53 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2024-09-05 18:31:59 +0200 |
commit | 2d516b8fc0f18ce9c0347a1aea6edb3d8ca1d692 (patch) | |
tree | 613d8ab7c6ff32968a0878bed17b5357d0f48e11 | |
parent | Merge tag 'amlogic-drivers-for-v6.12' of https://git.kernel.org/pub/scm/linux... (diff) | |
download | linux-2d516b8fc0f18ce9c0347a1aea6edb3d8ca1d692.tar.xz linux-2d516b8fc0f18ce9c0347a1aea6edb3d8ca1d692.zip |
platform: cznic: turris-omnia-mcu: Fix error check in omnia_mcu_register_trng()
The gpiod_to_irq() function never returns zero. It returns negative
error codes or a positive IRQ number. Update the checking to check
for negatives.
Fixes: 41bb142a4028 ("platform: cznic: turris-omnia-mcu: Add support for MCU provided TRNG")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Marek BehĂșn <kabel@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | drivers/platform/cznic/turris-omnia-mcu-trng.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/platform/cznic/turris-omnia-mcu-trng.c b/drivers/platform/cznic/turris-omnia-mcu-trng.c index ad953fb3c37a..9a1d9292dc9a 100644 --- a/drivers/platform/cznic/turris-omnia-mcu-trng.c +++ b/drivers/platform/cznic/turris-omnia-mcu-trng.c @@ -70,8 +70,8 @@ int omnia_mcu_register_trng(struct omnia_mcu *mcu) irq_idx = omnia_int_to_gpio_idx[__bf_shf(OMNIA_INT_TRNG)]; irq = gpiod_to_irq(gpio_device_get_desc(mcu->gc.gpiodev, irq_idx)); - if (!irq) - return dev_err_probe(dev, -ENXIO, "Cannot get TRNG IRQ\n"); + if (irq < 0) + return dev_err_probe(dev, irq, "Cannot get TRNG IRQ\n"); /* * If someone else cleared the TRNG interrupt but did not read the |