]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: cec: seco: unregister adapter on IR probe failure
authorMyeonghun Pak <mhun512@gmail.com>
Fri, 24 Apr 2026 14:36:01 +0000 (23:36 +0900)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Tue, 5 May 2026 10:38:48 +0000 (12:38 +0200)
If secocec_ir_probe() fails after cec_register_adapter() succeeds,
probe returns an error and the driver remove callback is not called.
The current unwind path unregisters the notifier and then falls through
to cec_delete_adapter(), which violates the CEC adapter lifetime rules
after a successful registration.

Add a registered-adapter unwind path that unregisters the notifier and
the adapter instead.

Fixes: daef95769b3a ("media: seco-cec: add Consumer-IR support")
Cc: stable@vger.kernel.org
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/cec/platform/seco/seco-cec.c

index b7bb49f023957716f9720f7e0bed6b4c37501681..97ed9654c78a10d53c2bcc141a698de1a4dd8a0d 100644 (file)
@@ -649,7 +649,7 @@ static int secocec_probe(struct platform_device *pdev)
 
        ret = secocec_ir_probe(secocec);
        if (ret)
-               goto err_notifier;
+               goto err_unregister_adapter;
 
        platform_set_drvdata(pdev, secocec);
 
@@ -657,6 +657,10 @@ static int secocec_probe(struct platform_device *pdev)
 
        return ret;
 
+err_unregister_adapter:
+       cec_notifier_cec_adap_unregister(secocec->notifier, secocec->cec_adap);
+       cec_unregister_adapter(secocec->cec_adap);
+       goto err;
 err_notifier:
        cec_notifier_cec_adap_unregister(secocec->notifier, secocec->cec_adap);
 err_delete_adapter: