Re: [PATCH] thermal/drivers/qcom/lmh: Fix missing IRQ check in lmh_probe()

From: Konrad Dybcio
Date: Mon Aug 28 2023 - 07:09:09 EST


On 26.08.2023 13:09, Zhang Shurong wrote:
> This func misses checking for platform_get_irq()'s call and may passes the
> negative error codes to request_irq(), which takes unsigned IRQ #,
> causing it to fail with -EINVAL, overriding an original error code.
>
> Fix this by stop calling request_irq() with invalid IRQ #s.
>
> Fixes: 53bca371cdf7 ("thermal/drivers/qcom: Add support for LMh driver")
> Signed-off-by: Zhang Shurong <zhang_shurong@xxxxxxxxxxx>
> ---
> drivers/thermal/qcom/lmh.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/qcom/lmh.c b/drivers/thermal/qcom/lmh.c
> index f6edb12ec004..38aedb9a7c67 100644
> --- a/drivers/thermal/qcom/lmh.c
> +++ b/drivers/thermal/qcom/lmh.c
> @@ -198,7 +198,11 @@ static int lmh_probe(struct platform_device *pdev)
> return ret;
> }
>
> - lmh_data->irq = platform_get_irq(pdev, 0);
> + ret = platform_get_irq(pdev, 0);
> + if (ret < 0)
> + return ret;
> +
> + lmh_data->irq = ret;
Similarly to the other patch, please assign to lmh_data->irq directly

Konrad