Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3749095pxk; Tue, 29 Sep 2020 05:27:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmjBTFWhBWrCfhtr/hhz9kTWdMdQVR2ApCGUUu3vXvtlPRL9PgRZI1uX2XSYt+VFmgLase X-Received: by 2002:a17:907:2115:: with SMTP id qn21mr3541870ejb.278.1601382419868; Tue, 29 Sep 2020 05:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601382419; cv=none; d=google.com; s=arc-20160816; b=ylhliKBZgSNDo20AQNmX8iin7nybEjCH5k8GpgISH9kzornt7intldDz/PgTZE8B01 E6TS7GD8JZw9IUEoBnpQnlgkju0eQ5T8pNdyoBjOPFv2Htw1XTY4h3MR65f3CDxxY4f0 bRjCtHkj9voMTdOZKNP0mtF88uwURhlYQ8TVWj3LUXsYzprG/Qs94jND1arsCEdn2pKd vKXUfCy5gHZcl+IASpolZJLxPkhswAad85PDaL2zJ7VExa40MBHaeXP8I7aJjfF4iea/ YDEo/r7Ad8QEIBOmZQ0vLKLHzdEJjhgW/wHs9bmoEjS30Ffsd7rLpsILSSIjpmV3O9hp Q1/g== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=0uwSdUl2Hn0gr8eS+2KaEmyRtHX7bkykVGBXncLbYmc=; b=DyUqWlrOU5qQRzcMVUkZtRC1nMqZzaDNLbc6Caoe0YdD6VJCRX7vL4ezVkQsm0QsZ1 oAmTURMnQ4yP8iIMxxCmJha9B+SmjyBx6bkcdaw8+Ui/CyxbUBUrln2la8u3v5BmsasL iLOuI+jWm1/Q6nACbPP14ZBboPPne3Wy4OqmWgQFZJtaumYmGDNRqryLDsF/UYoNbxGc g4yHSRBR7CNs7xl4CGl5Yy112DMaJMCmojatMeyng66deDNRS61MuuBa6Jk1tX4X+jm5 S3ozlCGPuuh8mwZu8urSI4F0s91W9zy6gBJCbzDYpv5HPvVdDPWXiWjh9UUUf3Zk2d60 RMhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="GNW/wMNW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p7si2687926edq.28.2020.09.29.05.26.36; Tue, 29 Sep 2020 05:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="GNW/wMNW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732710AbgI2MZl (ORCPT + 99 others); Tue, 29 Sep 2020 08:25:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:38420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732695AbgI2MZ2 (ORCPT ); Tue, 29 Sep 2020 08:25:28 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 38DB92075F; Tue, 29 Sep 2020 12:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601382327; bh=vdV0cPfcuBlzJ8bZGMb5ArwZmErrYSk6dciDVr0yxG8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GNW/wMNW3TBN29OzymiX57VJRFRzW7OLdpBHVaye5aH28MC5iShFP1/0cs6qOpdfD lNpxyZqB0D8A2oYtBtcGvl9QQ1m+At3IeSWTeNisGEOyX6FyWnc3p5z3zqsmyBKh3N bwSnucX9F8d1YVo/3wYWDo6uIoajDWtEUQz2q5Iw= Date: Tue, 29 Sep 2020 14:25:33 +0200 From: Greg Kroah-Hartman To: poeschel@lemonage.de Cc: "Rafael J. Wysocki" , open list Subject: Re: [PATCH] driver core: Remove double assignment Message-ID: <20200929122533.GA1193271@kroah.com> References: <20200929115808.2815382-1-poeschel@lemonage.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200929115808.2815382-1-poeschel@lemonage.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 29, 2020 at 01:58:08PM +0200, poeschel@lemonage.de wrote: > From: Lars Poeschel > > This removes an assignment in device_add. It assigned the parent > kobject to the kobject of the new device. This is not necessary, > because the call to kobject_add a few lines later also does this same > assignment. > > Signed-off-by: Lars Poeschel > --- > drivers/base/core.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/base/core.c b/drivers/base/core.c > index bb5806a2bd4c..03b5396cd192 100644 > --- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -2847,8 +2847,6 @@ int device_add(struct device *dev) > error = PTR_ERR(kobj); > goto parent_error; > } > - if (kobj) > - dev->kobj.parent = kobj; > > /* use parent numa_node */ > if (parent && (dev_to_node(dev) == NUMA_NO_NODE)) > @@ -2856,7 +2854,7 @@ int device_add(struct device *dev) > > /* first, register with generic layer. */ > /* we require the name to be set before, and pass NULL */ > - error = kobject_add(&dev->kobj, dev->kobj.parent, NULL); > + error = kobject_add(&dev->kobj, kobj, NULL); That's very subtle, and might not really be correct for all users, have you checked? Anyway, I'd rather leave this as-is if possible, as we know this works correctly, and it is not going to save any time/energy to remove that assignment, right? thanks, greg k-h