From patchwork Tue Feb 19 13:24:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10819907 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 791B81805 for ; Tue, 19 Feb 2019 13:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 681272BF64 for ; Tue, 19 Feb 2019 13:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C03E2C221; Tue, 19 Feb 2019 13:24:59 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 043CE2C17F for ; Tue, 19 Feb 2019 13:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728786AbfBSNY5 (ORCPT ); Tue, 19 Feb 2019 08:24:57 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:49182 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728747AbfBSNY4 (ORCPT ); Tue, 19 Feb 2019 08:24:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=a4D5eqjpPs86CBBsvAftQHWh9l71anAHWt50GV4ud6E=; b=ArpMkG/ST3ipO8MvaBVArBRfW 3CHvrayle4f78MyG+Jsf9mPl76KVJn9OMDV9tnLL0TEJ3k39yxHxzhePU7SGxTL4rCLC7aibUQSd/ Wz6AmN8wP1v9iw0r/uAuQNfi1nQcIRp4XNTXzotSQncMelnIufkdvl1EGsUzOGr/nOeeuZLTUmtQe YVtGdyZjyR+BnyLLW8CBjXuxZjWRIUIgF1WK5Ngg54ZpSIGEaGpKBsxlgN4msIZx6TGni9A1kVmwq kI4FhkoEZD+kpmXdp3yfV6JHdbn/CqEKGRQpWHvd9p8TpVGE8p5UbwQAlVPcCyucm8ZTow+X+jy2/ 8eXH0x+CQ==; Received: from 177.96.194.24.dynamic.adsl.gvt.net.br ([177.96.194.24] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gw5OJ-0005BK-UR; Tue, 19 Feb 2019 13:24:55 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.91) (envelope-from ) id 1gw5OH-0001Ia-AM; Tue, 19 Feb 2019 08:24:53 -0500 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Rui Miguel Silva , Steve Longerbeam , Philipp Zabel , Greg Kroah-Hartman , devel@driverdev.osuosl.org Subject: [PATCH 1/2] media: imx7-media-csi: don't store a floating pointer Date: Tue, 19 Feb 2019 08:24:51 -0500 Message-Id: <1c186d5fd734e63305352986b6c5e84d19375787.1550582690.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) 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 if imx7_csi_try_fmt() fails, outcc variable won't be initialized and csi->cc[IMX7_CSI_PAD_SRC] would be pointing to a random location. Signed-off-by: Mauro Carvalho Chehab Reviewed-by: Rui Miguel Silva --- drivers/staging/media/imx/imx7-media-csi.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index d775e259fece..0b1788d79ce9 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -980,10 +980,10 @@ static int imx7_csi_get_fmt(struct v4l2_subdev *sd, return ret; } -static void imx7_csi_try_fmt(struct imx7_csi *csi, - struct v4l2_subdev_pad_config *cfg, - struct v4l2_subdev_format *sdformat, - const struct imx_media_pixfmt **cc) +static int imx7_csi_try_fmt(struct imx7_csi *csi, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *sdformat, + const struct imx_media_pixfmt **cc) { const struct imx_media_pixfmt *in_cc; struct v4l2_mbus_framefmt *in_fmt; @@ -992,7 +992,7 @@ static void imx7_csi_try_fmt(struct imx7_csi *csi, in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK, sdformat->which); if (!in_fmt) - return; + return -EINVAL; switch (sdformat->pad) { case IMX7_CSI_PAD_SRC: @@ -1023,8 +1023,10 @@ static void imx7_csi_try_fmt(struct imx7_csi *csi, false); break; default: + return -EINVAL; break; } + return 0; } static int imx7_csi_set_fmt(struct v4l2_subdev *sd, @@ -1067,8 +1069,10 @@ static int imx7_csi_set_fmt(struct v4l2_subdev *sd, format.pad = IMX7_CSI_PAD_SRC; format.which = sdformat->which; format.format = sdformat->format; - imx7_csi_try_fmt(csi, cfg, &format, &outcc); - + if (imx7_csi_try_fmt(csi, cfg, &format, &outcc)) { + ret = -EINVAL; + goto out_unlock; + } outfmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SRC, sdformat->which); *outfmt = format.format; From patchwork Tue Feb 19 13:24:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 10819905 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 659AB13BF for ; Tue, 19 Feb 2019 13:24:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5366F2C1F9 for ; Tue, 19 Feb 2019 13:24:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 46B6F2C218; Tue, 19 Feb 2019 13:24:59 +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=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,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 D7BBB2BF64 for ; Tue, 19 Feb 2019 13:24:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727529AbfBSNY5 (ORCPT ); Tue, 19 Feb 2019 08:24:57 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:49184 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728630AbfBSNY4 (ORCPT ); Tue, 19 Feb 2019 08:24:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xLyc0G5IaKS96Akucq00qcfns0vn3r1wLQhrkAQg2O0=; b=ForfPBL5/D3SGaBuEiKGBYmk2H D9pioilA8QllFS1BWf2tQGEzJvNmQAgYDCAU0kaPZH7ty6iE7jUcVkBS+Rk4ncGrQuBMH6vq0rZ7g L70DoRJJ5YE21ZaSiT0hKaD0d38TwGCRixWJhOB6u+d21njGuFwypL1xAlWLII1bMNgAorxLB5F1/ JweYITzTpgHviVmebFxBKNrEGjrsVB9SoVSyXJ9CNps1MrQ8Bir9nx1FmWh4I/l5WpfzTKBazux/B rGZESr2ijLkl5QySirhEq5p05FfLl/+aI9Bbi7cOpMCG8o7YmJghe6O2mqQ+23PQ0js1/F8ps5sD6 VLDzpYBw==; Received: from 177.96.194.24.dynamic.adsl.gvt.net.br ([177.96.194.24] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gw5OJ-0005BJ-Tu; Tue, 19 Feb 2019 13:24:55 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.91) (envelope-from ) id 1gw5OH-0001Id-BP; Tue, 19 Feb 2019 08:24:53 -0500 From: Mauro Carvalho Chehab Cc: Mauro Carvalho Chehab , Linux Media Mailing List , Mauro Carvalho Chehab , Rui Miguel Silva , Steve Longerbeam , Philipp Zabel , Greg Kroah-Hartman , devel@driverdev.osuosl.org Subject: [PATCH 2/2] media: imx7-media-csi: get rid of unused var Date: Tue, 19 Feb 2019 08:24:52 -0500 Message-Id: <91937229883824924f1a06ded49dfded4ca96d43.1550582690.git.mchehab+samsung@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <1c186d5fd734e63305352986b6c5e84d19375787.1550582690.git.mchehab+samsung@kernel.org> References: <1c186d5fd734e63305352986b6c5e84d19375787.1550582690.git.mchehab+samsung@kernel.org> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) 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 drivers/staging/media/imx/imx7-media-csi.c: In function 'imx7_csi_enum_mbus_code': drivers/staging/media/imx/imx7-media-csi.c:926:33: warning: variable 'in_cc' set but not used [-Wunused-but-set-variable] const struct imx_media_pixfmt *in_cc; ^~~~~ Signed-off-by: Mauro Carvalho Chehab Acked-by: Rui Miguel Silva --- drivers/staging/media/imx/imx7-media-csi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 0b1788d79ce9..3fba7c27c0ec 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -923,7 +923,6 @@ static int imx7_csi_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_mbus_code_enum *code) { struct imx7_csi *csi = v4l2_get_subdevdata(sd); - const struct imx_media_pixfmt *in_cc; struct v4l2_mbus_framefmt *in_fmt; int ret = 0; @@ -931,8 +930,6 @@ static int imx7_csi_enum_mbus_code(struct v4l2_subdev *sd, in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK, code->which); - in_cc = imx_media_find_mbus_format(in_fmt->code, CS_SEL_ANY, true); - switch (code->pad) { case IMX7_CSI_PAD_SINK: ret = imx_media_enum_mbus_format(&code->code, code->index,