Message ID | tencent_A0D4966C4180DD7B582A20A06A49ECDD600A@qq.com |
---|---|
State | New |
Headers | show |
Series | thermal/drivers/qcom/lmh: Fix missing IRQ check in lmh_probe() | expand |
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@foxmail.com> > --- > 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
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; lmh_data->domain = irq_domain_add_linear(np, 1, &lmh_irq_ops, lmh_data); if (!lmh_data->domain) { dev_err(dev, "Error adding irq_domain\n");
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@foxmail.com> --- drivers/thermal/qcom/lmh.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)