mirror of
https://github.com/torvalds/linux.git
synced 2026-05-25 15:41:52 +02:00
media: uvcvideo: Refactor uvc_v4l2_compat_ioctl32
Declaring a variable for doing automatic cleanup is not a very common pattern. Replace the cleanup macro with manual cleanup to make the code simpler. Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Link: https://lore.kernel.org/r/20250509-uvc-followup-v1-3-73bcde30d2b5@chromium.org Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
parent
7e666b1aac
commit
7651fab885
|
|
@ -1382,11 +1382,9 @@ static int uvc_v4l2_put_xu_query(const struct uvc_xu_control_query *kp,
|
|||
#define UVCIOC_CTRL_MAP32 _IOWR('u', 0x20, struct uvc_xu_control_mapping32)
|
||||
#define UVCIOC_CTRL_QUERY32 _IOWR('u', 0x21, struct uvc_xu_control_query32)
|
||||
|
||||
DEFINE_FREE(uvc_pm_put, struct uvc_device *, if (_T) uvc_pm_put(_T))
|
||||
static long uvc_v4l2_compat_ioctl32(struct file *file,
|
||||
unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct uvc_device *uvc_device __free(uvc_pm_put) = NULL;
|
||||
struct uvc_fh *handle = file->private_data;
|
||||
union {
|
||||
struct uvc_xu_control_mapping xmap;
|
||||
|
|
@ -1399,38 +1397,38 @@ static long uvc_v4l2_compat_ioctl32(struct file *file,
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
uvc_device = handle->stream->dev;
|
||||
|
||||
switch (cmd) {
|
||||
case UVCIOC_CTRL_MAP32:
|
||||
ret = uvc_v4l2_get_xu_mapping(&karg.xmap, up);
|
||||
if (ret)
|
||||
return ret;
|
||||
break;
|
||||
ret = uvc_ioctl_xu_ctrl_map(handle->chain, &karg.xmap);
|
||||
if (ret)
|
||||
return ret;
|
||||
break;
|
||||
ret = uvc_v4l2_put_xu_mapping(&karg.xmap, up);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
break;
|
||||
break;
|
||||
|
||||
case UVCIOC_CTRL_QUERY32:
|
||||
ret = uvc_v4l2_get_xu_query(&karg.xqry, up);
|
||||
if (ret)
|
||||
return ret;
|
||||
break;
|
||||
ret = uvc_xu_ctrl_query(handle->chain, &karg.xqry);
|
||||
if (ret)
|
||||
return ret;
|
||||
break;
|
||||
ret = uvc_v4l2_put_xu_query(&karg.xqry, up);
|
||||
if (ret)
|
||||
return ret;
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
return -ENOIOCTLCMD;
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
}
|
||||
|
||||
uvc_pm_put(handle->stream->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user