From: bui duc phuc <[email protected]>
Use dev_err_probe() for devm_clk_get() to prevent log spam when probe
returns -EPROBE_DEFER.
Drop the redundant error message after devm_request_irq(), since the
helper already reports request failures internally.
Return the original error from platform_get_irq() instead of replacing
it with -EINVAL.
Signed-off-by: bui duc phuc <[email protected]>
---
Changes in v2:
- Clarify the commit message to better describe the purpose of
using dev_err_probe()
drivers/input/keyboard/st-keyscan.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/input/keyboard/st-keyscan.c b/drivers/input/keyboard/st-keyscan.c
index e53ef4c670e4..8e9bac339dc4 100644
--- a/drivers/input/keyboard/st-keyscan.c
+++ b/drivers/input/keyboard/st-keyscan.c
@@ -173,10 +173,9 @@ static int keyscan_probe(struct platform_device *pdev)
return PTR_ERR(keypad_data->base);
keypad_data->clk = devm_clk_get(&pdev->dev, NULL);
- if (IS_ERR(keypad_data->clk)) {
- dev_err(&pdev->dev, "cannot get clock\n");
- return PTR_ERR(keypad_data->clk);
- }
+ if (IS_ERR(keypad_data->clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(keypad_data->clk),
+ "cannot get clock\n");
error = clk_enable(keypad_data->clk);
if (error) {
@@ -188,14 +187,12 @@ static int keyscan_probe(struct platform_device *pdev)
keypad_data->irq = platform_get_irq(pdev, 0);
if (keypad_data->irq < 0)
- return -EINVAL;
+ return keypad_data->irq;
error = devm_request_irq(&pdev->dev, keypad_data->irq, keyscan_isr, 0,
pdev->name, keypad_data);
- if (error) {
- dev_err(&pdev->dev, "failed to request IRQ\n");
+ if (error)
return error;
- }
error = input_register_device(input_dev);
if (error) {
--
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.