Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp7052964yba; Thu, 2 May 2019 03:25:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9tNvdZkcW/sJwkUwRHo6U5MHekkSO7scZ4VeY9EHkcOAsD2XB12UDq3PCZSbNOLclbW5+ X-Received: by 2002:a17:902:42a5:: with SMTP id h34mr2844002pld.146.1556792703543; Thu, 02 May 2019 03:25:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556792703; cv=none; d=google.com; s=arc-20160816; b=wPBe9q4WofbCJFoMkfFPaakYxzynYsxbd1vsFOQs7D4MRVfTjGmOK65kak88L2E8XB MZx5laxhNqPrHKuZFV3XvAwNQoa8JU9ijUfO43HfyglQnmITaMSP/VuCtTzU/yFRN9JD 8ibbt15ZAKmLt0Mv5PWETh63gdslG+xUpo6zt58Wfa0Yns6hKHw7sv8PSWt+bUGwqOzp xzvhbOgDPY0OBuIuwfWyvY60gfxwvWOQOTKVVrDZtD5/DuloHMv5Gs1qKXdcznKZV8Cl ASAQXx/mokHtiXjJ69Ziz6ft8ugjlTWM7Sh7p9qW1MOseRa6O13hkjlIDjhkkQsDbT/p HODg== 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:dkim-signature; bh=R9ub8GzXv+ewxIF41/uqyEU7y6zrhigWQFGMR9dzS5E=; b=hi9krpHIOFhhWHKpcogWC0aQvpV96VL/u6AzFn4QOaqekIe/JTkM2WmSqIibRvZS7W 3vjtfeozso1uDqULjxzhpifK/NjY1DhBTT1AQ8uvnNWwaovqL+dsnmFCY3FKaKQiW4Ay fybeTpJygJS7yzc3JjXOu+rmrc2ngnJZsWNgyOAaS8OJLkfDILPpkbcJJj/Fg6PcvX8d fLaHg8tN7hzNHKarSAJJlsMrFNT4oaz6e4hZqLm0Tha6fNfOMTNU7uu0xBdWbFVDJJkz U47aioEMwJFSa7OEzHXi9AQfjxeB376KvCe15sIPV9iK9gRMMYtWKV6/cUJfTV0ixw0z bNuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TDJPehgF; 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 31si2062367pli.390.2019.05.02.03.24.48; Thu, 02 May 2019 03:25:03 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=default header.b=TDJPehgF; 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 S1726350AbfEBKW2 (ORCPT + 99 others); Thu, 2 May 2019 06:22:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:36712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbfEBKW2 (ORCPT ); Thu, 2 May 2019 06:22:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 AE8D7206DF; Thu, 2 May 2019 10:22:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556792547; bh=4mdXNVY+kl8cfyLSCQh4IJghFaPWYmafUtecWx4C16Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TDJPehgFE1ceoeouin1SVGSnFGfo0tJRn79/zfaAOhvE57cR4UaaM/xgZEMde+9yg d1VcUWhBzCNcJpC1x9YFccXf/HgtNIJJQmEZiGp+5KsNrmvrm/IAUOogQ0/Y1s+67L aIKzR/deFfy+mGa2ItldUuepKDrhLvVq+c1upkU0= Date: Thu, 2 May 2019 12:22:24 +0200 From: Greg Kroah-Hartman To: "Tobin C. Harding" Cc: "Rafael J. Wysocki" , cl@linux.com, tycho@tycho.ws, willy@infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] kobject: clean up the kobject add documentation a bit more Message-ID: <20190502102224.GA15012@kroah.com> References: <20190427081330.GA26788@eros.localdomain> <20190427192809.GA8454@kroah.com> <20190501215616.GD18827@eros.localdomain> <20190502071742.GC16247@kroah.com> <20190502072808.GA14064@kroah.com> <20190502081918.GA18363@eros.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190502081918.GA18363@eros.localdomain> User-Agent: Mutt/1.11.4 (2019-03-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 1fd7c3b438a2 ("kobject: Improve doc clarity kobject_init_and_add()") tried to provide more clarity, but the reference to kobject_del() was incorrect. Fix that up by removing that line, and hopefully be more explicit as to exactly what needs to happen here once you register a kobject with the kobject core. Cc: Tobin C. Harding Fixes: 1fd7c3b438a2 ("kobject: Improve doc clarity kobject_init_and_add()") Signed-off-by: Greg Kroah-Hartman diff --git a/lib/kobject.c b/lib/kobject.c index 3f4b7e95b0c2..f2ccdbac8ed9 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -416,8 +416,12 @@ static __printf(3, 0) int kobject_add_varg(struct kobject *kobj, * to this function be directly freed with a call to kfree(), * that can leak memory. * - * If this call returns successfully and you later need to unwind - * kobject_add() for the error path you should call kobject_del(). + * If this function returns success, kobject_put() must also be called + * in order to properly clean up the memory associated with the object. + * + * In short, once this function is called, kobject_put() MUST be called + * when the use of the object is finished in order to properly free + * everything. */ int kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt, ...)