Skip to contentSkip to conversation

media: v4l2-ctrls: Return handler error in creating new fwnode properties

PATCH In review Sakari Ailus 2 participants 2 messages Apr 12, 2024 – Apr 15, 2024 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/media/v4l2-core/v4l2-ctrls-core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/media/v4l2-core/v4l2-ctrls-core.c +3 -0
index c4d995f32191..670325ca995e 100644
@@ -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;
 
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw

Hi Sakari,

Quoted 6 lines · Sakari Ailus

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.

Quoted 18 lines
---
  drivers/media/v4l2-core/v4l2-ctrls-core.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/media/v4l2-core/v4l2-ctrls-core.c +3 -0
index c4d995f32191..670325ca995e 100644
@@ -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;