mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
media: ccs: Correct error handling in ccs_register_subdev
ccs_register_subdev() did not clean up the media entity in error case, do that now. Also switch to goto based error handling. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
724ff68e96
commit
f055e53ebc
|
|
@ -2968,7 +2968,7 @@ static int ccs_register_subdev(struct ccs_sensor *sensor,
|
|||
rval = v4l2_device_register_subdev(sensor->src->sd.v4l2_dev, &ssd->sd);
|
||||
if (rval) {
|
||||
dev_err(&client->dev, "v4l2_device_register_subdev failed\n");
|
||||
return rval;
|
||||
goto out_media_entity_cleanup;
|
||||
}
|
||||
|
||||
rval = media_create_pad_link(&ssd->sd.entity, source_pad,
|
||||
|
|
@ -2976,11 +2976,18 @@ static int ccs_register_subdev(struct ccs_sensor *sensor,
|
|||
link_flags);
|
||||
if (rval) {
|
||||
dev_err(&client->dev, "media_create_pad_link failed\n");
|
||||
v4l2_device_unregister_subdev(&ssd->sd);
|
||||
return rval;
|
||||
goto out_v4l2_device_unregister_subdev;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
out_v4l2_device_unregister_subdev:
|
||||
v4l2_device_unregister_subdev(&ssd->sd);
|
||||
|
||||
out_media_entity_cleanup:
|
||||
media_entity_cleanup(&ssd->sd.entity);
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
static void ccs_unregistered(struct v4l2_subdev *subdev)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user