Skip to content

Commit

Permalink
mfd: fsl-imx25: Fix check for platform_get_irq() errors
Browse files Browse the repository at this point in the history
[ Upstream commit 75db790 ]

The mx25_tsadc_remove() function assumes all non-zero returns are success
but the platform_get_irq() function returns negative on error and
positive non-zero values on success.  It never returns zero, but if it
did then treat that as a success.

Fixes: 18f7739 ("mfd: fsl-imx25: Clean up irq settings during removal")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/YvTfkbVQWYKMKS/t@kili
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Oct 21, 2022
1 parent 09379a4 commit 400e960
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/mfd/fsl-imx25-tsadc.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static int mx25_tsadc_setup_irq(struct platform_device *pdev,
int irq;

irq = platform_get_irq(pdev, 0);
if (irq <= 0)
if (irq < 0)
return irq;

tsadc->domain = irq_domain_add_simple(np, 2, 0, &mx25_tsadc_domain_ops,
Expand All @@ -89,7 +89,7 @@ static int mx25_tsadc_unset_irq(struct platform_device *pdev)
struct mx25_tsadc *tsadc = platform_get_drvdata(pdev);
int irq = platform_get_irq(pdev, 0);

if (irq) {
if (irq >= 0) {
irq_set_chained_handler_and_data(irq, NULL, NULL);
irq_domain_remove(tsadc->domain);
}
Expand Down

0 comments on commit 400e960

Please sign in to comment.