Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2387933rwl; Thu, 6 Apr 2023 09:31:04 -0700 (PDT) X-Google-Smtp-Source: AKy350Z+mghe5w6GREDkNNlyQUU1YvS3MK9OlzE785u2uCuO6FyXLC5gDCMImgz25sgrMFPJB6Ri X-Received: by 2002:a17:90b:1e0a:b0:23d:27fc:8437 with SMTP id pg10-20020a17090b1e0a00b0023d27fc8437mr7109350pjb.14.1680798663676; Thu, 06 Apr 2023 09:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680798663; cv=none; d=google.com; s=arc-20160816; b=VrxSaYjqG2VMkJdImdZeN9WPPsypP2AvhnJI3kvddprTgUm/x8EkwFCDqyGCMheJls UIeqB1LVJkQ5eN5/Ei3CgmXpNYLGKHDSqQBHX4qmx36s/Q79RMGDa9I3e0mILhzqzDG8 cIZOXVzMQPoDilD3aj6Ewrq0H2IlHEGFjJu13VtkK7Nz4cPUKkBfxyWEXzdA+tT2WjvQ ubRbX7O+354NtauOrb6vwRLUci+rM4rD180x1130xedaHzooUIZTSjGSjtqXiVI/S7jt HLQPY6tXYoUZ96mWeNvhBin1uQywN4DxAiq3Ler7G6gcsLJD30yOrEIsOe/2xY9Dlq+R 7uXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=i1ZcgoaE/sir21FP4H++k2EEOI09T0zvnL4f4ZpNvK0=; b=bbVt1AFqizDurzoqexMHMBiqrSHTLBIXtJAmRFbcP/OzUXldLRCGC7/buye/sQE95E LHRnllfb5EYrWr6WTNKTpYVPBNx3+1rtc+4IKRDkmJHEjnUI7kg5LLByiE992qibpVPn jmg4ygkkOiehm1RES5L1tj3EY+lCbhjqhG5MKRgLeYr9BFFx3NRTKZhDPlnv5vgQYeCD wCaXwiC1kDdjCj/cROrxUSlgebfke9cAmZyfIFEX+PtVNwxcYHV43OKcepl4RARrZJV+ gmWK/i2IMuZVRd7yOpi+NcxDSkRnFmr2cTlbQDqYYzaLLLx7Rm9zG7MazGG3WIg6SqRS OCCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S5r1Vmuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a17090a7e0d00b0023d226f7217si4158397pjl.134.2023.04.06.09.30.51; Thu, 06 Apr 2023 09:31:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S5r1Vmuj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239543AbjDFQRn (ORCPT + 99 others); Thu, 6 Apr 2023 12:17:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239765AbjDFQRm (ORCPT ); Thu, 6 Apr 2023 12:17:42 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D7E8171B; Thu, 6 Apr 2023 09:17:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680797855; x=1712333855; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=BheIOBQvfp+BM3i8yAMZ/e171IUo4NjjXSX9/irNeMQ=; b=S5r1VmujncaVaJnec01Gmh7Je6UFK4MCNXpIh0djArk8moO1h4K6vpS8 d7W2JdS8uyIetKP0eAlJxXfwKB+U0ZAj6UKkMphdlC/Hjhl1D/NCccsoX qf1xd/GuPkVynKlelBUxRlC8pavFrT8DmZ+xtX+3BwKwihGpDI5s0gSOs EFH0REDZC8suR5VqMkU5Zh3w60PdWIv5BzgBugTzr8t6H5Dfv15gwMYGm AReH2Ej0ekIqbpilMXrLZBLXl3Z3i3MvRxQMkJjKpeJHDGeeHzN9OB+yP 4fgvEeud2V+d7nPXC/q2UKDs8OxEPHoNP4WtJHJ03vZ993r+7lt6/6lta g==; X-IronPort-AV: E=McAfee;i="6600,9927,10672"; a="341510078" X-IronPort-AV: E=Sophos;i="5.98,323,1673942400"; d="scan'208";a="341510078" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2023 09:16:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10672"; a="776522346" X-IronPort-AV: E=Sophos;i="5.98,323,1673942400"; d="scan'208";a="776522346" Received: from yilunxu-optiplex-7050.sh.intel.com (HELO localhost) ([10.239.159.165]) by FMSMGA003.fm.intel.com with ESMTP; 06 Apr 2023 09:16:22 -0700 Date: Fri, 7 Apr 2023 00:04:42 +0800 From: Xu Yilun To: alexis.lothore@bootlin.com Cc: mdf@kernel.org, hao.wu@intel.com, trix@redhat.com, russell.h.weight@intel.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, nicolas.carrier@orolia.com Subject: Re: [PATCH] fpga: bridge: properly initialize bridge device before populating children Message-ID: References: <20230404133102.2837535-1-alexis.lothore@bootlin.com> <20230404133102.2837535-2-alexis.lothore@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230404133102.2837535-2-alexis.lothore@bootlin.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-04-04 at 15:31:02 +0200, alexis.lothore@bootlin.com wrote: > From: Alexis Lothor? > > The current code path can lead to warnings because of uninitialized device, > which contains, as a consequence, uninitialized kobject. The uninitialized > device is passed to of_platform_populate, which will at some point, while > creating child device, try to get a reference on uninitialized parent, > resulting in the following warning: > > kobject: '(null)' ((ptrval)): is not initialized, yet kobject_get() is > being called. > > The warning is observed after migrating a kernel 5.10.x to 6.1.x. > Reverting commit 0d70af3c2530 ("fpga: bridge: Use standard dev_release for > class driver") seems to remove the warning. > This commit aggregates device_initialize() and device_add() into > device_register() but this new call is done AFTER of_platform_populate > > Fixes: 0d70af3c2530 ("fpga: bridge: Use standard dev_release for class driver") > Signed-off-by: Alexis Lothor? > --- > drivers/fpga/fpga-bridge.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c > index 727704431f61..13918c8c839e 100644 > --- a/drivers/fpga/fpga-bridge.c > +++ b/drivers/fpga/fpga-bridge.c > @@ -360,7 +360,6 @@ fpga_bridge_register(struct device *parent, const char *name, > bridge->dev.parent = parent; > bridge->dev.of_node = parent->of_node; > bridge->dev.id = id; > - of_platform_populate(bridge->dev.of_node, NULL, NULL, &bridge->dev); > > ret = dev_set_name(&bridge->dev, "br%d", id); > if (ret) > @@ -372,6 +371,8 @@ fpga_bridge_register(struct device *parent, const char *name, > return ERR_PTR(ret); > } > > + of_platform_populate(bridge->dev.of_node, NULL, NULL, &bridge->dev); It makes sense. Acked-by: Xu Yilun Applied > + > return bridge; > > error_device: > -- > 2.40.0 >