mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
media: usb: go7007: s2250-board: fix leak in probe()
[ Upstream commit67e4550ecd] Call i2c_unregister_device(audio) on this error path. Fixes:d3b2ccd9e3("[media] s2250: convert to the control framework") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
ec8a37b2d9
commit
44973633b0
|
|
@ -504,6 +504,7 @@ static int s2250_probe(struct i2c_client *client,
|
||||||
u8 *data;
|
u8 *data;
|
||||||
struct go7007 *go = i2c_get_adapdata(adapter);
|
struct go7007 *go = i2c_get_adapdata(adapter);
|
||||||
struct go7007_usb *usb = go->hpi_context;
|
struct go7007_usb *usb = go->hpi_context;
|
||||||
|
int err = -EIO;
|
||||||
|
|
||||||
audio = i2c_new_dummy_device(adapter, TLV320_ADDRESS >> 1);
|
audio = i2c_new_dummy_device(adapter, TLV320_ADDRESS >> 1);
|
||||||
if (IS_ERR(audio))
|
if (IS_ERR(audio))
|
||||||
|
|
@ -532,11 +533,8 @@ static int s2250_probe(struct i2c_client *client,
|
||||||
V4L2_CID_HUE, -512, 511, 1, 0);
|
V4L2_CID_HUE, -512, 511, 1, 0);
|
||||||
sd->ctrl_handler = &state->hdl;
|
sd->ctrl_handler = &state->hdl;
|
||||||
if (state->hdl.error) {
|
if (state->hdl.error) {
|
||||||
int err = state->hdl.error;
|
err = state->hdl.error;
|
||||||
|
goto fail;
|
||||||
v4l2_ctrl_handler_free(&state->hdl);
|
|
||||||
kfree(state);
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
state->std = V4L2_STD_NTSC;
|
state->std = V4L2_STD_NTSC;
|
||||||
|
|
@ -600,7 +598,7 @@ static int s2250_probe(struct i2c_client *client,
|
||||||
i2c_unregister_device(audio);
|
i2c_unregister_device(audio);
|
||||||
v4l2_ctrl_handler_free(&state->hdl);
|
v4l2_ctrl_handler_free(&state->hdl);
|
||||||
kfree(state);
|
kfree(state);
|
||||||
return -EIO;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int s2250_remove(struct i2c_client *client)
|
static int s2250_remove(struct i2c_client *client)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user