From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B85F4C4727C for ; Tue, 29 Sep 2020 12:25:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D0B5208FE for ; Tue, 29 Sep 2020 12:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601382343; bh=vdV0cPfcuBlzJ8bZGMb5ArwZmErrYSk6dciDVr0yxG8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=Q1acUtHe2ffJbiP5lbcnJKlRGL794+nMUXLq6QNvGmDCOT2ZFaEtUYCH5z8sq/8aR /dkHMl7wwLz/QHqg4vX5aQoVcgYC+m2F5WSaXmDbKR8x9Cmcxz6A9xv2Jn36teuzIg QlMzUns872f+tA56kHOT5LojNXy2l3olhcOncIzo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732714AbgI2MZm (ORCPT ); Tue, 29 Sep 2020 08:25:42 -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