Skip to content

Commit cafb3ab

Browse files
krzkdtor
authored andcommitted
Input: sun4i-ps2 - fix handling of platform_get_irq() error
platform_get_irq() returns -ERRNO on error. In such case comparison to 0 would pass the check. Fixes: e443631 ("Input: serio - add support for Alwinner A10/A20 PS/2 controller") Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Acked-by: Chen-Yu Tsai <wens@csie.org> Link: https://lore.kernel.org/r/20200828145744.3636-4-krzk@kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent c277e1f commit cafb3ab

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

‎drivers/input/serio/sun4i-ps2.c‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
211211
struct sun4i_ps2data *drvdata;
212212
struct serio *serio;
213213
struct device *dev = &pdev->dev;
214-
unsigned int irq;
215214
int error;
216215

217216
drvdata = kzalloc(sizeof(struct sun4i_ps2data), GFP_KERNEL);
@@ -264,14 +263,12 @@ static int sun4i_ps2_probe(struct platform_device *pdev)
264263
writel(0, drvdata->reg_base + PS2_REG_GCTL);
265264

266265
/* Get IRQ for the device */
267-
irq = platform_get_irq(pdev, 0);
268-
if (!irq) {
269-
dev_err(dev, "no IRQ found\n");
270-
error = -ENXIO;
266+
drvdata->irq = platform_get_irq(pdev, 0);
267+
if (drvdata->irq < 0) {
268+
error = drvdata->irq;
271269
goto err_disable_clk;
272270
}
273271

274-
drvdata->irq = irq;
275272
drvdata->serio = serio;
276273
drvdata->dev = dev;
277274

0 commit comments

Comments
 (0)