[PATCH] uvcvideo: Return -EINVAL when setting a menu control to an invalid value

2013-03-28 Thread Laurent Pinchart
-ERANGE is the right error code when the value is outside of the menu
range, but -EINVAL must be reported for invalid values inside the range.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/usb/uvc/uvc_ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c
index 61e28de..a2f4501 100644
--- a/drivers/media/usb/uvc/uvc_ctrl.c
+++ b/drivers/media/usb/uvc/uvc_ctrl.c
@@ -1487,7 +1487,7 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
step = mapping-get(mapping, UVC_GET_RES,
uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES));
if (!(step  value))
-   return -ERANGE;
+   return -EINVAL;
}
 
break;
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] uvcvideo: Return -EINVAL when setting a menu control to an invalid value

2013-03-28 Thread Hans Verkuil
On Thu March 28 2013 12:10:56 Laurent Pinchart wrote:
 -ERANGE is the right error code when the value is outside of the menu
 range, but -EINVAL must be reported for invalid values inside the range.
 
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

Acked-by: Hans Verkuil hans.verk...@cisco.com

Regards,

Hans

 ---
  drivers/media/usb/uvc/uvc_ctrl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/media/usb/uvc/uvc_ctrl.c 
 b/drivers/media/usb/uvc/uvc_ctrl.c
 index 61e28de..a2f4501 100644
 --- a/drivers/media/usb/uvc/uvc_ctrl.c
 +++ b/drivers/media/usb/uvc/uvc_ctrl.c
 @@ -1487,7 +1487,7 @@ int uvc_ctrl_set(struct uvc_video_chain *chain,
   step = mapping-get(mapping, UVC_GET_RES,
   uvc_ctrl_data(ctrl, UVC_CTRL_DATA_RES));
   if (!(step  value))
 - return -ERANGE;
 + return -EINVAL;
   }
  
   break;
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html