From patchwork Thu Sep 27 15:16:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 1514881 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id A65123FC71 for ; Thu, 27 Sep 2012 15:16:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755154Ab2I0PQE (ORCPT ); Thu, 27 Sep 2012 11:16:04 -0400 Received: from perceval.ideasonboard.com ([95.142.166.194]:60155 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754331Ab2I0PPv (ORCPT ); Thu, 27 Sep 2012 11:15:51 -0400 Received: from avalon.ideasonboard.com (unknown [91.178.154.29]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 093CC35A8B; Thu, 27 Sep 2012 17:15:50 +0200 (CEST) From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: Hans Verkuil Subject: [PATCH 2/6] uvcvideo: Return -EACCES when trying to access a read/write-only control Date: Thu, 27 Sep 2012 17:16:16 +0200 Message-Id: <1348758980-21683-3-git-send-email-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 1.7.8.6 In-Reply-To: <1348758980-21683-1-git-send-email-laurent.pinchart@ideasonboard.com> References: <1348758980-21683-1-git-send-email-laurent.pinchart@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The proper return code according to the V4L2 specification is -EACCES, not -EINVAL. Signed-off-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_ctrl.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index 7879d30..3e0b66e 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -927,7 +927,7 @@ static int __uvc_ctrl_get(struct uvc_video_chain *chain, int ret; if ((ctrl->info.flags & UVC_CTRL_FLAG_GET_CUR) == 0) - return -EINVAL; + return -EACCES; if (!ctrl->loaded) { ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id, @@ -1435,7 +1435,7 @@ int uvc_ctrl_set(struct uvc_video_chain *chain, if (ctrl == NULL) return -ENOENT; if (!(ctrl->info.flags & UVC_CTRL_FLAG_SET_CUR)) - return -EINVAL; + return -EACCES; /* Clamp out of range values. */ switch (mapping->v4l2_type) {