Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4857334ybv; Wed, 26 Feb 2020 04:17:28 -0800 (PST) X-Google-Smtp-Source: APXvYqw/6ETUf0dFSUtjYatHKp7P1oQM3WglZgAvp2TucmW7lYic+JaBtmWSMR8y4T2cST8yhHnS X-Received: by 2002:a05:6830:1598:: with SMTP id i24mr2936759otr.260.1582719448250; Wed, 26 Feb 2020 04:17:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582719448; cv=none; d=google.com; s=arc-20160816; b=yBlnzvOMIIN5qVHz30vDnbPJNqqDMj4oDP5IKh3Uf7fGp6mixy6O9Bwe+0+WmyFmWB dWGx6blFdcC+6O7B/R91YNFbOLKwHknMJeRx6mr7YLokLt8pSnjGhJtXJUUVazV30N6Q 8kibgnST5bWB+bdZHtDf2a86+sJL+/n7cZgT92SWnDTaFkhaMzXkoHAJvmPCFDz5F7Mq jHEr/JDE574zsxnk8HSuXvgFAoN2mNpSQhAY+xOhT5dFy0xLGv0fuyyZFcy72OTf26fb zLWVyrt8x4HZQvROSTQrEDNkE0TXaycUp4DfzVdSW4O8ypH/q3RweeyoJHxe7Q1pXSkv JSiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:ironport-sdr; bh=byD+7nvJS63YxCpjtdKDg1dOnHeE1wroRt+q/5keu2w=; b=trmxZ8Ua5Gv4JOxDGEgnAUprLHj9hhwRyZzfFurHG4Wc41CFBKJM7Zln0Aavjwp+c0 D3qCSpMIjflEYm5WxrFM/Vn+/4Gx910lmk9GuwjoytjriO6U3vsh/mYmfmh60y2ipPOe Yb2YKTtmhAfFotVOpokSuAPQw8/ZjfPdsGxFllADrEn0Rxir9pMwlkYlXmXebkpFafG7 gbIIfahtu+tPRnU6Zbl5uSpTH+Jm2+7Hk1ph7CSl7eRCbofGzABdHDwHV/S0gKLV8HfM v6nm/1ASDy6b5RVR3iJrrzEoiBUg7IDT9o3ohRniu5bDI7EX1busl/3yQUO2BFRCzVEj NeBw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x26si641308otk.325.2020.02.26.04.17.15; Wed, 26 Feb 2020 04:17:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727253AbgBZMQq (ORCPT + 99 others); Wed, 26 Feb 2020 07:16:46 -0500 Received: from esa5.microchip.iphmx.com ([216.71.150.166]:64434 "EHLO esa5.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726334AbgBZMQp (ORCPT ); Wed, 26 Feb 2020 07:16:45 -0500 Received-SPF: Pass (esa5.microchip.iphmx.com: domain of Eugen.Hristev@microchip.com designates 198.175.253.82 as permitted sender) identity=mailfrom; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="Eugen.Hristev@microchip.com"; x-conformance=spf_only; x-record-type="v=spf1"; x-record-text="v=spf1 mx a:ushub1.microchip.com a:smtpout.microchip.com -exists:%{i}.spf.microchip.iphmx.com include:servers.mcsv.net include:mktomail.com include:spf.protection.outlook.com ~all" Received-SPF: None (esa5.microchip.iphmx.com: no sender authenticity information available from domain of postmaster@email.microchip.com) identity=helo; client-ip=198.175.253.82; receiver=esa5.microchip.iphmx.com; envelope-from="Eugen.Hristev@microchip.com"; x-sender="postmaster@email.microchip.com"; x-conformance=spf_only Authentication-Results: esa5.microchip.iphmx.com; spf=Pass smtp.mailfrom=Eugen.Hristev@microchip.com; spf=None smtp.helo=postmaster@email.microchip.com; dmarc=pass (p=none dis=none) d=microchip.com IronPort-SDR: WLyfkTDgGneTpST693ZioNpeej+UlfBbge9U50URHNUKwyAERzwLnyW7rHR6LpQSz78F0vYgiQ Djd36NLBtvVv9Tl+wxBfxq0GwSfeHHwtznV/bi51vF/3u1qLrGoRj21DkKRqO2neo9ueJT99Hb nWlCbbmDHRphMJJ6VBOY5DhmiE7No6yDI2oCjbcLlATz1maJzu6xSeN21PZC8FD56yDnTtD7j2 HFkeYzESvJJiDdGBSc1Kex8wVAN//A7QEqft3NiVOseqBIy0HdBWcWJEo+zrEd8UwLqbef4Af8 es8= X-IronPort-AV: E=Sophos;i="5.70,488,1574146800"; d="scan'208";a="66801767" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 26 Feb 2020 05:16:45 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 26 Feb 2020 05:16:56 -0700 Received: from ROB-ULT-M18282.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 26 Feb 2020 05:16:42 -0700 From: Eugen Hristev To: , , , CC: Eugen Hristev Subject: [PATCH] media: v4l2-core: fix entity initialization in device_register_subdev Date: Wed, 26 Feb 2020 14:15:45 +0200 Message-ID: <20200226121545.19880-1-eugen.hristev@microchip.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The check for parameters is done below in the function. Initialize the entity variable properly, after the parameters have been checked. Fixes: 61f5db549dde ("[media] v4l: Make v4l2_subdev inherit from media_entity") Signed-off-by: Eugen Hristev --- drivers/media/v4l2-core/v4l2-device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index 63d6b147b21e..6e33132ebb19 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -112,7 +112,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, struct v4l2_subdev *sd) { #if defined(CONFIG_MEDIA_CONTROLLER) - struct media_entity *entity = &sd->entity; + struct media_entity *entity; #endif int err; @@ -141,6 +141,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, goto error_module; #if defined(CONFIG_MEDIA_CONTROLLER) + entity = &sd->entity; /* Register the entity. */ if (v4l2_dev->mdev) { err = media_device_register_entity(v4l2_dev->mdev, entity); -- 2.20.1