mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
media: v4l: async: Clean up error handling in v4l2_async_match_notify
Add labels for error handling instead of doing it all in individual cases. Prepare for more functionality in this function. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Tested-by: Philipp Zabel <p.zabel@pengutronix.de> # imx6qp Tested-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> # rcar + adv746x Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Tested-by: Aishwarya Kothari <aishwarya.kothari@toradex.com> # Apalis i.MX6Q with TC358743 Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> # Renesas RZ/G2L SMARC Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
adb2dcd5f2
commit
ed59bbe18d
1 changed files with 12 additions and 9 deletions
|
@ -320,10 +320,8 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
|
|||
return ret;
|
||||
|
||||
ret = v4l2_async_nf_call_bound(notifier, sd, asc);
|
||||
if (ret < 0) {
|
||||
v4l2_device_unregister_subdev(sd);
|
||||
return ret;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto err_unregister_subdev;
|
||||
|
||||
/*
|
||||
* Depending of the function of the entities involved, we may want to
|
||||
|
@ -332,11 +330,8 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
|
|||
* pad).
|
||||
*/
|
||||
ret = v4l2_async_create_ancillary_links(notifier, sd);
|
||||
if (ret) {
|
||||
v4l2_async_nf_call_unbind(notifier, sd, asc);
|
||||
v4l2_device_unregister_subdev(sd);
|
||||
return ret;
|
||||
}
|
||||
if (ret)
|
||||
goto err_call_unbind;
|
||||
|
||||
list_del(&asc->waiting_entry);
|
||||
sd->asd = asc;
|
||||
|
@ -363,6 +358,14 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
|
|||
subdev_notifier->parent = notifier;
|
||||
|
||||
return v4l2_async_nf_try_all_subdevs(subdev_notifier);
|
||||
|
||||
err_call_unbind:
|
||||
v4l2_async_nf_call_unbind(notifier, sd, asc);
|
||||
|
||||
err_unregister_subdev:
|
||||
v4l2_device_unregister_subdev(sd);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Test all async sub-devices in a notifier for a match. */
|
||||
|
|
Loading…
Add table
Reference in a new issue