Commit fc045645 authored by Chuhong Yuan's avatar Chuhong Yuan Committed by Mauro Carvalho Chehab

media: budget-core: Improve exception handling in budget_register()

budget_register() has no error handling after its failure.
Add the missed undo functions for error handling to fix it.
Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 6499a0db
...@@ -369,20 +369,25 @@ static int budget_register(struct budget *budget) ...@@ -369,20 +369,25 @@ static int budget_register(struct budget *budget)
ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->hw_frontend); ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->hw_frontend);
if (ret < 0) if (ret < 0)
return ret; goto err_release_dmx;
budget->mem_frontend.source = DMX_MEMORY_FE; budget->mem_frontend.source = DMX_MEMORY_FE;
ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->mem_frontend); ret = dvbdemux->dmx.add_frontend(&dvbdemux->dmx, &budget->mem_frontend);
if (ret < 0) if (ret < 0)
return ret; goto err_release_dmx;
ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, &budget->hw_frontend); ret = dvbdemux->dmx.connect_frontend(&dvbdemux->dmx, &budget->hw_frontend);
if (ret < 0) if (ret < 0)
return ret; goto err_release_dmx;
dvb_net_init(&budget->dvb_adapter, &budget->dvb_net, &dvbdemux->dmx); dvb_net_init(&budget->dvb_adapter, &budget->dvb_net, &dvbdemux->dmx);
return 0; return 0;
err_release_dmx:
dvb_dmxdev_release(&budget->dmxdev);
dvb_dmx_release(&budget->demux);
return ret;
} }
static void budget_unregister(struct budget *budget) static void budget_unregister(struct budget *budget)
......
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