From patchwork Mon Feb 20 12:06:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Machek X-Patchwork-Id: 9582679 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 17D8760578 for ; Mon, 20 Feb 2017 12:07:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08C6027EED for ; Mon, 20 Feb 2017 12:07:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFBA527FAD; Mon, 20 Feb 2017 12:07:04 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 B43D227EED for ; Mon, 20 Feb 2017 12:07:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753241AbdBTMGv (ORCPT ); Mon, 20 Feb 2017 07:06:51 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:35186 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752822AbdBTMGv (ORCPT ); Mon, 20 Feb 2017 07:06:51 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 51BA381876; Mon, 20 Feb 2017 13:06:48 +0100 (CET) Date: Mon, 20 Feb 2017 13:06:47 +0100 From: Pavel Machek To: Laurent Pinchart Cc: Sakari Ailus , mchehab@kernel.org, kernel list , ivo.g.dimitrov.75@gmail.com, sre@kernel.org, pali.rohar@gmail.com, linux-media@vger.kernel.org Subject: [PATCH] omap3isp: avoid uninitialized memory Message-ID: <20170220120647.GA19951@amd> References: <20161228183036.GA13139@amd> <10545906.Gxg3yScdu4@avalon> <20170215094228.GA8586@amd> <2414221.XNA4JCFMRx@avalon> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <2414221.XNA4JCFMRx@avalon> User-Agent: Mutt/1.5.23 (2014-03-12) 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 Code in ispcsiphy is quite confusing, and does not initialize phy1 in case of isp rev. 2. Set it to zero, to prevent confusion. Signed-off-by: Pavel Machek index 8f73f6d..a2474b6 100644 --- a/drivers/media/platform/omap3isp/ispcsiphy.c +++ b/drivers/media/platform/omap3isp/ispcsiphy.c @@ -362,14 +374,16 @@ int omap3isp_csiphy_init(struct isp_device *isp) phy2->phy_regs = OMAP3_ISP_IOMEM_CSIPHY2; mutex_init(&phy2->mutex); - if (isp->revision == ISP_REVISION_15_0) { - phy1->isp = isp; - phy1->csi2 = &isp->isp_csi2c; - phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES; - phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1; - phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1; - mutex_init(&phy1->mutex); + if (isp->revision != ISP_REVISION_15_0) { + memset(phy1, sizeof(*phy1), 0); + return 0; } + phy1->isp = isp; + phy1->csi2 = &isp->isp_csi2c; + phy1->num_data_lanes = ISP_CSIPHY1_NUM_DATA_LANES; + phy1->cfg_regs = OMAP3_ISP_IOMEM_CSI2C_REGS1; + phy1->phy_regs = OMAP3_ISP_IOMEM_CSIPHY1; + mutex_init(&phy1->mutex); return 0; }