mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
media: rc: sunxi-cir: Unregister rc device on probe failure
After rc_register_device() succeeds, later probe failures must undo the
registration with rc_unregister_device(). The current error path jumps to
the allocation cleanup label and only calls rc_free_device(), leaving the
rc device registration and resources created by rc_register_device()
behind.
Add a registered-device unwind label for the IRQ lookup, IRQ request, and
hardware initialization failure paths. Keep rc_free_device() for failures
before rc_register_device() succeeds.
Fixes: b4e3e59fb5 ("[media] rc: add sunxi-ir driver")
Cc: stable@vger.kernel.org
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
This commit is contained in:
parent
e9c44d4ecc
commit
479aa6fa8c
|
|
@ -344,22 +344,25 @@ static int sunxi_ir_probe(struct platform_device *pdev)
|
|||
ir->irq = platform_get_irq(pdev, 0);
|
||||
if (ir->irq < 0) {
|
||||
ret = ir->irq;
|
||||
goto exit_free_dev;
|
||||
goto exit_unregister_dev;
|
||||
}
|
||||
|
||||
ret = devm_request_irq(dev, ir->irq, sunxi_ir_irq, 0, SUNXI_IR_DEV, ir);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed request irq\n");
|
||||
goto exit_free_dev;
|
||||
goto exit_unregister_dev;
|
||||
}
|
||||
|
||||
ret = sunxi_ir_hw_init(dev);
|
||||
if (ret)
|
||||
goto exit_free_dev;
|
||||
goto exit_unregister_dev;
|
||||
|
||||
dev_info(dev, "initialized sunXi IR driver\n");
|
||||
return 0;
|
||||
|
||||
exit_unregister_dev:
|
||||
rc_unregister_device(ir->rc);
|
||||
|
||||
exit_free_dev:
|
||||
rc_free_device(ir->rc);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user