On Fri Apr 24 23:36:01 2026 +0900, Myeonghun Pak wrote:
> 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: [email protected]
> Signed-off-by: Myeonghun Pak <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/cec/platform/seco/seco-cec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

---

diff --git a/drivers/media/cec/platform/seco/seco-cec.c 
b/drivers/media/cec/platform/seco/seco-cec.c
index b7bb49f02395..97ed9654c78a 100644
--- a/drivers/media/cec/platform/seco/seco-cec.c
+++ b/drivers/media/cec/platform/seco/seco-cec.c
@@ -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:
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to