1

gpio: stmpe: Simplify with dev_err_probe()

Use dev_err_probe() to simplify the error path and unify a message
template.

Using this helper is totally fine even if err is known to never
be -EPROBE_DEFER.

The benefit compared to a normal dev_err() is the standardized format
of the error code, it being emitted symbolically and the fact that
the error code is returned which allows more compact error paths.

Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240829131051.43200-1-shenlichuan@vivo.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
Shen Lichuan 2024-08-29 21:10:51 +08:00 committed by Bartosz Golaszewski
parent c4a315eaf8
commit 1882e76936

View File

@ -513,10 +513,9 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
stmpe_gpio_irq, IRQF_ONESHOT, stmpe_gpio_irq, IRQF_ONESHOT,
"stmpe-gpio", stmpe_gpio); "stmpe-gpio", stmpe_gpio);
if (ret) { if (ret)
dev_err(&pdev->dev, "unable to get irq: %d\n", ret); return dev_err_probe(&pdev->dev, ret,
return ret; "unable to get irq");
}
girq = &stmpe_gpio->chip.irq; girq = &stmpe_gpio->chip.irq;
gpio_irq_chip_set_chip(girq, &stmpe_gpio_irq_chip); gpio_irq_chip_set_chip(girq, &stmpe_gpio_irq_chip);