From patchwork Sat Mar 30 14:01:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10878505 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C8A4314DE for ; Sat, 30 Mar 2019 14:01:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3C8228770 for ; Sat, 30 Mar 2019 14:01:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A79B42896F; Sat, 30 Mar 2019 14:01:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CAD128770 for ; Sat, 30 Mar 2019 14:01:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730878AbfC3OBu (ORCPT ); Sat, 30 Mar 2019 10:01:50 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:45591 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730832AbfC3OBu (ORCPT ); Sat, 30 Mar 2019 10:01:50 -0400 Received: by mail-pg1-f195.google.com with SMTP id y3so2532978pgk.12 for ; Sat, 30 Mar 2019 07:01:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NRSN2gW2UsEiodzhVmvL27Mq5xFHHpwzHpOeOYU7YQE=; b=GBC2YOnyJLLSaGuA78uXB05r3/svvKPaT7JRpE+kbXN+3RTbOqNMr+JBrHoWo/vTqE Z+goU8A9TU0ydpnCvxWNySJgTVrJVg7u9BxfkOktaO0FWUEKavTJHYfeF0JXVQUDyZmH 6k2OLisE1lLFezHBik2L/wIU/GKl5YOCy2jqvyRJAdQHC5ZC3vNY9JpM4/tKgzqxLJ7+ SCDTvW4pJWc1XI2xqm84aXd+ebpRa0MyEvI8U3hmbJCUKNmyz86XPau1CCXuk3CLaLho Hs04hz1S9KoCG3tx9W4cvaj2W93uGBpD1BhYv5GCvodBFyqvHYnSiJzpde8Ml1heCMi/ 7zTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NRSN2gW2UsEiodzhVmvL27Mq5xFHHpwzHpOeOYU7YQE=; b=d6NL5rS7DwOG2twVIZR0ErkXpxY8ZQx9hY8B+9EY/cUrSxncQq3Q2vPhbQmeYi0ULC eOHnOf0JdnrVrIr0u8/vcqhWg4EpsPiyg1kOlC/r0ozZJPqpGLRJNCUkkFg3JNSw8Mmk sXpEilkQQZ/oNPDafunaqbyqsVT3HNbnyD6OoYuaC6vQ8eOUy8U0SWZEip0dEW+MgaSG Jm0calpddcyI4i0mDQv6//HhoC7zDt96FwSdDbg3bHaWzXPgSeDDANS9PBsa03VRn2Ez mG1DTk6ey2Go3cFLfg0caqe871ny/It5fCuytMB27NXa60UyONPmZkpjuYun7T2A/2CP mz1A== X-Gm-Message-State: APjAAAXBukv06xt1z/Ok/U/5Gl5xeJ74lkdypWeMezrRQGEKl1SKSB9N ADWs5+NQ2PmCMbriHuKbjsdms6qq X-Google-Smtp-Source: APXvYqwtwJWRjMZT22d1w66f34kd8mrvUeN35b+DepuREJ4wJYkG9iZQUTBCPNkbB/KfQJOYy1mwHw== X-Received: by 2002:a62:1fc3:: with SMTP id l64mr19455425pfj.37.1553954509727; Sat, 30 Mar 2019 07:01:49 -0700 (PDT) Received: from localhost.localdomain ([240f:34:212d:1:1b24:991b:df50:ea3f]) by smtp.gmail.com with ESMTPSA id b72sm18294289pga.86.2019.03.30.07.01.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Mar 2019 07:01:49 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , "Lad, Prabhakar" , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 1/2] media: ov2659: make S_FMT ioctl succeed even if requested format doesn't match Date: Sat, 30 Mar 2019 23:01:31 +0900 Message-Id: <1553954492-24982-2-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553954492-24982-1-git-send-email-akinobu.mita@gmail.com> References: <1553954492-24982-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This driver returns an error if unsupported media bus pixel code is requested by VIDIOC_SUBDEV_S_FMT. But according to Documentation/media/uapi/v4l/vidioc-subdev-g-fmt.rst, Drivers must not return an error solely because the requested format doesn't match the device capabilities. They must instead modify the format to match what the hardware can provide. So select default format code and return success in that case. This is detected by v4l2-compliance. Cc: "Lad, Prabhakar" Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita Acked-by: Lad, Prabhakar --- drivers/media/i2c/ov2659.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c index 799acce..a1e9a98 100644 --- a/drivers/media/i2c/ov2659.c +++ b/drivers/media/i2c/ov2659.c @@ -1117,8 +1117,10 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, if (ov2659_formats[index].code == mf->code) break; - if (index < 0) - return -EINVAL; + if (index < 0) { + index = 0; + mf->code = ov2659_formats[index].code; + } mf->colorspace = V4L2_COLORSPACE_SRGB; mf->field = V4L2_FIELD_NONE; From patchwork Sat Mar 30 14:01:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 10878507 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B552A1669 for ; Sat, 30 Mar 2019 14:01:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0EA628770 for ; Sat, 30 Mar 2019 14:01:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 953292896F; Sat, 30 Mar 2019 14:01:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4BF8A28770 for ; Sat, 30 Mar 2019 14:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730880AbfC3OBw (ORCPT ); Sat, 30 Mar 2019 10:01:52 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:42862 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730832AbfC3OBw (ORCPT ); Sat, 30 Mar 2019 10:01:52 -0400 Received: by mail-pf1-f194.google.com with SMTP id r15so2363468pfn.9 for ; Sat, 30 Mar 2019 07:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=El37trIfcT5Xnqpbt+DDC26KxBeO0bYNlPsDAubf7LQ=; b=knETNovwRV4bajrMP1UJTuFn6MPV5DABsc1edbIE6Rp7TJAZs+CrH2oZmBkZ2Ru4x6 PolN1vQvaP+s5jsnu9+AH3P20ewtFaZ8x9th6KM6TabZM3LnXhMr0+MicuiOkKn+nwxP 7n5ui/cPNhQD2UxHMmbY0a+6Pxggp+zdmG1hRYsCFBDRleHcA+DW/IImgEybJCMclOqJ Vl0JQLnNx+9sPbFWhg04zJrXGu41gcFki3dFgs6JNaM02LBK8zPKfCiAz2riY9nYiakO w0nXtUjWKeGrdlTXIVXCv4u/BWjNm9IcsJindtKy6IUbvFM/7ER5o/zTsnz8ZszaKkgA XacA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=El37trIfcT5Xnqpbt+DDC26KxBeO0bYNlPsDAubf7LQ=; b=c6FgM45y2bpNG2Z9MZwXeHkWzS/YFRtyc6I7HmbVJSvunwby6g4Le+giMJ2CzRQ4bO uBTsespOxrfgbhyHv1KAZ4KggfzUxMpyjZoRIhSfXU6gLH9USAtU8ILNTnMeG4SP3OjJ EWwpdb+55nPC+MoiBtP5/FdAI4EO8HLsfH0aLcinik+WFvOK0zjM+0xy0l/VSeJNrAwJ ABiqn90j5N0nizqCUNphvdJWpdXN7eL0B9XzF2zQj/07SMPjdCBXfd9CnZVfaSp6tDH/ 7eiAXQkDuwIAyh8WB7L8LHra5fLN/M3W6MHslYAK5xD+tF+PbmY6yCxTycesmIFYIGeW zCxw== X-Gm-Message-State: APjAAAXGn5cKtbvK6tSPlEeIKoeThQG8KjalERanxubB2yxvJ2gl5+iz SDA/IzinF+AdcUfbYmbaUl/jOUgE X-Google-Smtp-Source: APXvYqxI+hqBqyZ5y4z18P9O5mY0k5/PichIPbSNGRjQ7zVSVsxdl078jJ602HtRWq8W2DvDfi0aZw== X-Received: by 2002:a63:2ace:: with SMTP id q197mr7376773pgq.371.1553954511904; Sat, 30 Mar 2019 07:01:51 -0700 (PDT) Received: from localhost.localdomain ([240f:34:212d:1:1b24:991b:df50:ea3f]) by smtp.gmail.com with ESMTPSA id b72sm18294289pga.86.2019.03.30.07.01.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Mar 2019 07:01:51 -0700 (PDT) From: Akinobu Mita To: linux-media@vger.kernel.org Cc: Akinobu Mita , "Lad, Prabhakar" , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 2/2] media: ov2659: fix unbalanced mutex_lock/unlock Date: Sat, 30 Mar 2019 23:01:32 +0900 Message-Id: <1553954492-24982-3-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1553954492-24982-1-git-send-email-akinobu.mita@gmail.com> References: <1553954492-24982-1-git-send-email-akinobu.mita@gmail.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid returning with mutex locked. Fixes: fa8cb6444c32 ("[media] ov2659: Don't depend on subdev API") Cc: "Lad, Prabhakar" Cc: Sakari Ailus Cc: Mauro Carvalho Chehab Signed-off-by: Akinobu Mita Acked-by: Lad, Prabhakar --- drivers/media/i2c/ov2659.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov2659.c b/drivers/media/i2c/ov2659.c index a1e9a98..5ed2413 100644 --- a/drivers/media/i2c/ov2659.c +++ b/drivers/media/i2c/ov2659.c @@ -1132,7 +1132,7 @@ static int ov2659_set_fmt(struct v4l2_subdev *sd, mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); *mf = fmt->format; #else - return -ENOTTY; + ret = -ENOTTY; #endif } else { s64 val;