Commit aa9eda76 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: pulse8-cec: close serio in disconnect, not adap_free

The serio_close() call was moved to pulse8_cec_adap_free(),
but that can be too late if that is called after the serio
core pulled down the serio already, in which case you get
a kernel oops.

Keep it in the disconnect().
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Fixes: 601282d6 ("media: pulse8-cec: use adap_free callback")
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 34a81888
...@@ -635,8 +635,6 @@ static void pulse8_cec_adap_free(struct cec_adapter *adap) ...@@ -635,8 +635,6 @@ static void pulse8_cec_adap_free(struct cec_adapter *adap)
cancel_delayed_work_sync(&pulse8->ping_eeprom_work); cancel_delayed_work_sync(&pulse8->ping_eeprom_work);
cancel_work_sync(&pulse8->irq_work); cancel_work_sync(&pulse8->irq_work);
cancel_work_sync(&pulse8->tx_work); cancel_work_sync(&pulse8->tx_work);
serio_close(pulse8->serio);
serio_set_drvdata(pulse8->serio, NULL);
kfree(pulse8); kfree(pulse8);
} }
...@@ -652,6 +650,9 @@ static void pulse8_disconnect(struct serio *serio) ...@@ -652,6 +650,9 @@ static void pulse8_disconnect(struct serio *serio)
struct pulse8 *pulse8 = serio_get_drvdata(serio); struct pulse8 *pulse8 = serio_get_drvdata(serio);
cec_unregister_adapter(pulse8->adap); cec_unregister_adapter(pulse8->adap);
pulse8->serio = NULL;
serio_set_drvdata(serio, NULL);
serio_close(serio);
} }
static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio, static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
...@@ -872,10 +873,11 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv) ...@@ -872,10 +873,11 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv)
return 0; return 0;
close_serio: close_serio:
pulse8->serio = NULL;
serio_set_drvdata(serio, NULL);
serio_close(serio); serio_close(serio);
delete_adap: delete_adap:
cec_delete_adapter(pulse8->adap); cec_delete_adapter(pulse8->adap);
serio_set_drvdata(serio, NULL);
free_device: free_device:
kfree(pulse8); kfree(pulse8);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment