Message ID | 20230606031159.38246-1-jiasheng@iscas.ac.cn (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | [v3] gpio: sifive: Add missing check for platform_get_irq | expand |
Context | Check | Description |
---|---|---|
conchuod/cover_letter | success | Single patches do not need cover letters |
conchuod/tree_selection | success | Guessed tree name to be fixes at HEAD 6966d7988c4f |
conchuod/fixes_present | success | Fixes tag present in non-next series |
conchuod/maintainers_pattern | success | MAINTAINERS pattern errors before the patch: 6 and now 6 |
conchuod/verify_signedoff | success | Signed-off-by tag matches author and committer |
conchuod/kdoc | success | Errors and warnings before: 0 this patch: 0 |
conchuod/build_rv64_clang_allmodconfig | success | Errors and warnings before: 8 this patch: 8 |
conchuod/module_param | success | Was 0 now: 0 |
conchuod/build_rv64_gcc_allmodconfig | success | Errors and warnings before: 8 this patch: 8 |
conchuod/build_rv32_defconfig | success | Build OK |
conchuod/dtb_warn_rv64 | success | Errors and warnings before: 3 this patch: 3 |
conchuod/header_inline | success | No static functions without inline keyword in header files |
conchuod/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 14 lines checked |
conchuod/build_rv64_nommu_k210_defconfig | success | Build OK |
conchuod/verify_fixes | success | Fixes tag looks correct |
conchuod/build_rv64_nommu_virt_defconfig | success | Build OK |
On Tue, Jun 6, 2023 at 5:12 AM Jiasheng Jiang <jiasheng@iscas.ac.cn> wrote: > > Add the missing check for platform_get_irq() and return error code > if it fails. > The returned error code will be dealed with in > builtin_platform_driver(sifive_gpio_driver) and the driver will not > be registered. > > Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data") > Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> > --- > Changelog: > > v2 -> v3: > > 1. Check before assigning values. > > v1 -> v2: > > 1. Return "girq->parents[0]" instead of "-ENODEV". > --- > drivers/gpio/gpio-sifive.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c > index 98939cd4a71e..745e5f67254e 100644 > --- a/drivers/gpio/gpio-sifive.c > +++ b/drivers/gpio/gpio-sifive.c > @@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev) > return -ENODEV; > } > > - for (i = 0; i < ngpio; i++) > - chip->irq_number[i] = platform_get_irq(pdev, i); > + for (i = 0; i < ngpio; i++) { > + ret = platform_get_irq(pdev, i); > + if (ret < 0) > + return ret; > + chip->irq_number[i] = ret; > + } > > ret = bgpio_init(&chip->gc, dev, 4, > chip->base + SIFIVE_GPIO_INPUT_VAL, > -- > 2.25.1 > Applied, thanks! Bart
diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c index 98939cd4a71e..745e5f67254e 100644 --- a/drivers/gpio/gpio-sifive.c +++ b/drivers/gpio/gpio-sifive.c @@ -221,8 +221,12 @@ static int sifive_gpio_probe(struct platform_device *pdev) return -ENODEV; } - for (i = 0; i < ngpio; i++) - chip->irq_number[i] = platform_get_irq(pdev, i); + for (i = 0; i < ngpio; i++) { + ret = platform_get_irq(pdev, i); + if (ret < 0) + return ret; + chip->irq_number[i] = ret; + } ret = bgpio_init(&chip->gc, dev, 4, chip->base + SIFIVE_GPIO_INPUT_VAL,
Add the missing check for platform_get_irq() and return error code if it fails. The returned error code will be dealed with in builtin_platform_driver(sifive_gpio_driver) and the driver will not be registered. Fixes: f52d6d8b43e5 ("gpio: sifive: To get gpio irq offset from device tree data") Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn> --- Changelog: v2 -> v3: 1. Check before assigning values. v1 -> v2: 1. Return "girq->parents[0]" instead of "-ENODEV". --- drivers/gpio/gpio-sifive.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)