The vast majority of the callers of v4l2_ctrl_new_fwnode_properties() do
check the returned error code but the function does not set the control
handler's error on failure. This will make error handling more complicated
and prone for bugs.
Always assign the control handler's error field on error in
v4l2_ctrl_new_fwnode_properties().
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
orientation_ctrl = V4L2_CAMERA_ORIENTATION_EXTERNAL;
break;
default:
- return -EINVAL;
+ hdl->error = -EINVAL;
+ return hdl->error;
}
if (!v4l2_ctrl_new_std_menu(hdl, ctrl_ops,
V4L2_CID_CAMERA_ORIENTATION,
* not overwritten. Callers should register the controls they want to handle
* themselves before calling this function.
*
+ * This function will set the control handler's error field on failure, just as
+ * other functions adding controls to the handler.
+ *
* Return: 0 on success, a negative error code on failure.
*/
int v4l2_ctrl_new_fwnode_properties(struct v4l2_ctrl_handler *hdl,