Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp5014751ybv; Wed, 26 Feb 2020 07:01:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxSHkEIJvZSIKWUgskklsaR7cqaTf/2BqRRJRYzuDbMruzAl3vT6+YE0dMNB6FP2y0L+BLB X-Received: by 2002:aca:6749:: with SMTP id b9mr3319620oiy.13.1582729271787; Wed, 26 Feb 2020 07:01:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582729271; cv=none; d=google.com; s=arc-20160816; b=GtizNlVFxJ/KyWF+xWBg60UYnVcIBd3vcqQLY/HxGPypMjKlDatdDbEkOu7Ocsp+6O 2uCWJvuvatpw5aVh8uCCajcfVXVArPE7KgyHZYvRd3i/DoMObWaL4mKgE1WEW08ZiJwy b9XVe05CwJTBfgSCdfIiezS69YyY+nILclmeaxvS/EVMYyi9j7SAQyDFnkUXJw9Hhzgw 0kJ3k137aREIROWcKLWxAi5s3em9NCW4VSqrLrQ+gpp2e423UliOD7+SJItNsTJuDirz HGyVXJ4/k7EYi8U0AormpBIiz3l94wfe5I9YmDnnbR2w/8R6lSMD5h7Pc2Z1+8lk2FTc 8Q3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tR1OcX4jW6CjcjqTEJ9Xggm0IyiN/gWkQxYSNJ0R1MA=; b=BBuf/NBQ3+wfadNtOIAFE1rMza+Kaoso9fgkrr3s2tQS+Ei+K0+vZ/oyW63OoUg8vM qb3XrQWRFcfYCL1kNin8BkBxNh1JM+FuYvCGO6TkemBJykc1SR4lzpAPq+OxgUhEH0Q0 oK1XTrvozwgXXzLWmEcUEdtVd4KjZ7JhVzduVjy9/9dxJfWYWjjjJJvOoan09EiAJQxP 7lXHacJwQh1YmFh+KUSpP5k3UOXivVuDIKb4i849wLNIuH7pJwhLbfOBmQ2jXUSv3RQV ws3k7DHYY7AVjS7yo/6ydt9rOG4j66Y+xjcJi6nEuGwMzXQH31XPTp9h43HPX7nXQDFx QEYg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si1386028oiy.28.2020.02.26.07.00.59; Wed, 26 Feb 2020 07:01:11 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727405AbgBZPAO (ORCPT + 99 others); Wed, 26 Feb 2020 10:00:14 -0500 Received: from retiisi.org.uk ([95.216.213.190]:45628 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726345AbgBZPAO (ORCPT ); Wed, 26 Feb 2020 10:00:14 -0500 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2a01:4f9:c010:4572::80:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 285D4634C89; Wed, 26 Feb 2020 16:59:00 +0200 (EET) Received: from sailus by valkosipuli.localdomain with local (Exim 4.92) (envelope-from ) id 1j6y9M-0002KL-P0; Wed, 26 Feb 2020 16:59:00 +0200 Date: Wed, 26 Feb 2020 16:59:00 +0200 From: Sakari Ailus To: Eugen Hristev Cc: linux-media@vger.kernel.org, hverkuil@xs4all.nl, laurent.pinchart@ideasonboard.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] media: v4l2-core: fix entity initialization in device_register_subdev Message-ID: <20200226145900.GL5023@valkosipuli.retiisi.org.uk> References: <20200226121545.19880-1-eugen.hristev@microchip.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200226121545.19880-1-eugen.hristev@microchip.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eugen, On Wed, Feb 26, 2020 at 02:15:45PM +0200, Eugen Hristev wrote: > 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); Thanks for the patch. Instead of keeping a shorthand for entity locally, I'd just refer to &sd->entity. It's more simple, and gets away with one pair of #if / #endif as well. -- Regards, Sakari Ailus