Le 24/02/2025 à 05:19, Dmitry Osipenko a écrit :
On 2/24/25 00:11, Christophe JAILLET wrote:
+ ret = cec_register_adapter(cec->adap, cec->dev);
+ if (ret < 0) {
+ dev_err(cec->dev, "cec register adapter failed\n");
+ cec_unregister_adapter(cec->adap);
Is it needed to call cec_unregister_adapter() when
cec_register_adapter() fails?
Yes, it's confusing, but unregister is needed to free the adapter
properly, it's prepared to do it. Thanks for the review.
I don't know this API, so you'll get the last word, but
cec_unregister_adapter() does not seem to do that many things in such a
case, unless I miss something. See [1].
CJ
[1]: https://elixir.bootlin.com/linux/v6.14-rc3/source/drivers/media/
cec/core/cec-core.c#L370
On a second look, apparently you're right and
cec_notifier_cec_adap_unregister() should be used there.
So, maybe in the .remove() function as well?
CJ