Message ID | 20230502140612.2256850-1-alexander.stein@ew.tq-group.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/1] media: tc358743: fix cleanup path | expand |
Hi Alexander, On Tue, May 02, 2023 at 04:06:11PM +0200, Alexander Stein wrote: > When allocating a cec adapter, v4l2_async_register_subdev was called > already. Remove subdev from async list upon cec error. > > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> > --- > I don't reallylike that __maybe_unused after the label, but I don't know > of any other way to get rid of the warning of unused label if CEC > support is disabled. Thanks for the patch. There seem to be other issues to fix in the driver: registering the async sub-device here makes it possible to give user space with access to this device already here, before an interrupt is registered or the control handler is set up. How about instead moving the async sub-device registration at the very end of probe()? > > drivers/media/i2c/tc358743.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c > index ad6a72b2bcf5..86fc7bf12685 100644 > --- a/drivers/media/i2c/tc358743.c > +++ b/drivers/media/i2c/tc358743.c > @@ -2106,7 +2106,7 @@ static int tc358743_probe(struct i2c_client *client) > CEC_CAP_DEFAULTS | CEC_CAP_MONITOR_ALL, CEC_MAX_LOG_ADDRS); > if (IS_ERR(state->cec_adap)) { > err = PTR_ERR(state->cec_adap); > - goto err_hdl; > + goto err_async; > } > irq_mask |= MASK_CEC_RMSK | MASK_CEC_TMSK; > #endif > @@ -2162,6 +2162,8 @@ static int tc358743_probe(struct i2c_client *client) > flush_work(&state->work_i2c_poll); > cancel_delayed_work(&state->delayed_work_enable_hotplug); > mutex_destroy(&state->confctl_mutex); > +err_async: __maybe_unused > + v4l2_async_unregister_subdev(sd); > err_hdl: > media_entity_cleanup(&sd->entity); > v4l2_ctrl_handler_free(&state->hdl);
diff --git a/drivers/media/i2c/tc358743.c b/drivers/media/i2c/tc358743.c index ad6a72b2bcf5..86fc7bf12685 100644 --- a/drivers/media/i2c/tc358743.c +++ b/drivers/media/i2c/tc358743.c @@ -2106,7 +2106,7 @@ static int tc358743_probe(struct i2c_client *client) CEC_CAP_DEFAULTS | CEC_CAP_MONITOR_ALL, CEC_MAX_LOG_ADDRS); if (IS_ERR(state->cec_adap)) { err = PTR_ERR(state->cec_adap); - goto err_hdl; + goto err_async; } irq_mask |= MASK_CEC_RMSK | MASK_CEC_TMSK; #endif @@ -2162,6 +2162,8 @@ static int tc358743_probe(struct i2c_client *client) flush_work(&state->work_i2c_poll); cancel_delayed_work(&state->delayed_work_enable_hotplug); mutex_destroy(&state->confctl_mutex); +err_async: __maybe_unused + v4l2_async_unregister_subdev(sd); err_hdl: media_entity_cleanup(&sd->entity); v4l2_ctrl_handler_free(&state->hdl);
When allocating a cec adapter, v4l2_async_register_subdev was called already. Remove subdev from async list upon cec error. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> --- I don't reallylike that __maybe_unused after the label, but I don't know of any other way to get rid of the warning of unused label if CEC support is disabled. drivers/media/i2c/tc358743.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)