diff mbox series

[1/1] media: v4l2-ctrls: Return handler error in creating new fwnode properties

Message ID 20240412130901.849869-1-sakari.ailus@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/1] media: v4l2-ctrls: Return handler error in creating new fwnode properties | expand

Commit Message

Sakari Ailus April 12, 2024, 1:09 p.m. UTC
If the control handler is in an error state, return that error immediately
in v4l2_ctrl_new_fwnode_properties(). Effectively the change here is that
the same error code (handler's error) is returned in all cases instead of
possibly returning -EINVAL.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/media/v4l2-core/v4l2-ctrls-core.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Umang Jain April 15, 2024, 6:11 a.m. UTC | #1
Hi Sakari,

On 12/04/24 6:39 pm, Sakari Ailus wrote:
> If the control handler is in an error state, return that error immediately
> in v4l2_ctrl_new_fwnode_properties(). Effectively the change here is that
> the same error code (handler's error) is returned in all cases instead of
> possibly returning -EINVAL.
>
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>

> ---
>   drivers/media/v4l2-core/v4l2-ctrls-core.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> index c4d995f32191..670325ca995e 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
> @@ -2564,6 +2564,9 @@ int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl,
>   				    const struct v4l2_ctrl_ops *ctrl_ops,
>   				    const struct v4l2_fwnode_device_properties *p)
>   {
> +	if (hdl->error)
> +		return hdl->error;
> +
>   	if (p->orientation != V4L2_FWNODE_PROPERTY_UNSET) {
>   		u32 orientation_ctrl;
>
diff mbox series

Patch

diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c
index c4d995f32191..670325ca995e 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls-core.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c
@@ -2564,6 +2564,9 @@  int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl,
 				    const struct v4l2_ctrl_ops *ctrl_ops,
 				    const struct v4l2_fwnode_device_properties *p)
 {
+	if (hdl->error)
+		return hdl->error;
+
 	if (p->orientation != V4L2_FWNODE_PROPERTY_UNSET) {
 		u32 orientation_ctrl;