media: vidtv: fix driver unbind/remove

The current remove logic is broken and causes an OOPS.

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2020-09-11 13:14:36 +02:00
parent 1f9a704601
commit 63101b7568
3 changed files with 5 additions and 24 deletions

View File

@ -472,30 +472,16 @@ static int vidtv_bridge_remove(struct platform_device *pdev)
mutex_destroy(&dvb->feed_lock);
for (i = 0; i < NUM_FE; ++i)
dvb->demux.dmx.remove_frontend(&dvb->demux.dmx,
&dvb->dmx_fe[i]);
for (i = 0; i < NUM_FE; ++i) {
dvb_unregister_frontend(dvb->fe[i]);
dvb_module_release(dvb->i2c_client_tuner[i]);
dvb_module_release(dvb->i2c_client_demod[i]);
}
dvb_dmxdev_release(&dvb->dmx_dev);
dvb_dmx_release(&dvb->demux);
for (i = 0; i < NUM_FE; ++i) {
dvb_unregister_frontend(dvb->fe[i]);
dvb_frontend_detach(dvb->fe[i]);
}
dvb_unregister_adapter(&dvb->adapter);
for (i = 0; i < NUM_FE; i++)
dvb_module_release(dvb->i2c_client_tuner[i]);
for (i = 0; i < NUM_FE ; i++)
dvb_module_release(dvb->i2c_client_demod[i]);
dvb_unregister_adapter(&dvb->adapter);
i2c_del_adapter(&dvb->i2c_adapter);
return 0;
}

View File

@ -416,8 +416,6 @@ static int vidtv_demod_i2c_remove(struct i2c_client *client)
{
struct vidtv_demod_state *state = i2c_get_clientdata(client);
memset(&state->frontend.ops, 0, sizeof(struct dvb_frontend_ops));
state->frontend.demodulator_priv = NULL;
kfree(state);
return 0;

View File

@ -402,10 +402,7 @@ static int vidtv_tuner_i2c_probe(struct i2c_client *client,
static int vidtv_tuner_i2c_remove(struct i2c_client *client)
{
struct vidtv_tuner_dev *tuner_dev = i2c_get_clientdata(client);
struct dvb_frontend *fe = tuner_dev->fe;
memset(&fe->ops.tuner_ops, 0, sizeof(struct dvb_tuner_ops));
fe->tuner_priv = NULL;
kfree(tuner_dev);
return 0;