Re: [PATCH v2 1/2] Input: snvs_pwrkey: Improve probe error handling

[email protected]
Newsgroups org.kernel.vger.linux-input
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Low] Direct use of `input_event()` instead of specific reporting helpers.
--

--- Patch [1]: [PATCH v2 1/2] Input: snvs_pwrkey: Improve probe error handling ---
commit 1bfa57ab7fcf3071071b3cf879e2dfcda7662e49
Author: bui duc phuc <[email protected]>

Input: snvs_pwrkey: Improve probe error handling

Use dev_err_probe() for devm_clk_get() to prevent log spam when probe
returns -EPROBE_DEFER. Return the original error from platform_get_irq()
instead of replacing it with -EINVAL. Drop the redundant error message
after devm_request_irq().

> diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
> index 954055aaf6e29..fa08ac561bf23 100644
> --- a/drivers/input/keyboard/snvs_pwrkey.c
> +++ b/drivers/input/keyboard/snvs_pwrkey.c
> @@ -142,16 +142,15 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
>  	}
>  
>  	clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
> -	if (IS_ERR(clk)) {
> -		dev_err(&pdev->dev, "Failed to get snvs clock (%pe)\n", clk);
> -		return PTR_ERR(clk);
> -	}
> +	if (IS_ERR(clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(clk),
> +				     "Failed to get snvs clock\n");
>  
>  	pdata->wakeup = of_property_read_bool(np, "wakeup-source");

[ ... ]

[Severity: Low]
This isn't a bug introduced by this patch, but since you are improving this
driver, should imx_imx_snvs_check_for_events() use input_report_key() rather
than calling input_event() directly?

drivers/input/keyboard/snvs_pwrkey.c:imx_imx_snvs_check_for_events() {
    ...
	if (state ^ pdata->keystate) {
		pdata->keystate = state;
		input_event(input, EV_KEY, pdata->keycode, state);
		input_sync(input);
		pm_relax(pdata->input->dev.parent);
	}
    ...
}

The subsystem guidelines suggest using the specific reporting helpers like
input_report_key() instead of generic input_event() when the event type
is known.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
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.