Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5944464ybi; Wed, 12 Jun 2019 11:08:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWMJeQAx0P35ZlXBvpBvqDrgMkDrurcfJ/XW3b9RpAMP+RPtFPTMNwYBq04Tlyy1OLFOv0 X-Received: by 2002:a63:2848:: with SMTP id o69mr26275758pgo.258.1560362902066; Wed, 12 Jun 2019 11:08:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560362902; cv=none; d=google.com; s=arc-20160816; b=q44Bfh2oMKgt6Hj7rG2endEZiTp6Q1ExXwjCzEZpHapJ7Vsf02aOzXFwFbapjSZNEl vd/cJvjC3tbStB1GzbAj/x+1SJTvwYyCpUhKA05aLwv6DyIlYuYWUzFiGNgRq2qZF9QD ex0PiC0uY3Pk1S55QU31RzmgQocX9/F/ipXJnGvL369gwmjUtby0FnqeNAZ6JsYIQdfB dCFdxN2YGy6flqR9bDElWZPHELFVczBtiB0W16fTtei8EgAiEI9P3RQfedaZQcw+CoAp hpSlnvuaV4NJSVx9GQEniw9KmCNJonPZozGDikrbr5UabwJWd2YWSklKU0UV2j0FMnrX m8Gg== 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=hRl0VKwvEh7S5LbGYxXxyaCum6nOPxeztg+O3YpgBOE=; b=JfLsF6aNu0+zpcVFFJtMp2+Czf/7Pn8yrudDSVldbGVYQcDTECJMsAxbK/Nu+DE+iu ZswHd94IyCqr1nYFGHHp1wJzvKAGgUqZLu+I0cnWmi3XtRhvLApXocLhux3Y3B31U+9/ z0T36hXYMXFVY0IxTbSFWJB8FXlFyhKZHEUP0eIQeqa1Bl0QqAxSlDLDpYzc4o1GprFg ++QnLRa9R4zQkAQqWZK8b3xVPKct8cHfnLrn31aNw/fxLuA+N4Meh1fwvuZR9Q6jBic7 wWWf5N5aydoane+/uR/7siakrV5B1Cc2dJu/iLNjMd1Z/hJM4myuu121HYagLTL7O5ev rNRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XUO24YX2; 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 b40si318313pla.49.2019.06.12.11.08.07; Wed, 12 Jun 2019 11:08:22 -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=XUO24YX2; 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 S2438300AbfFLRKa (ORCPT + 99 others); Wed, 12 Jun 2019 13:10:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:50900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725844AbfFLRK3 (ORCPT ); Wed, 12 Jun 2019 13:10:29 -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 B732921019; Wed, 12 Jun 2019 17:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560359429; bh=pR3lImaJcFV2m+YhE4MeLz9MG23pccWXMxksWRjf92Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XUO24YX2cpqrqgDpiQshwO9BAcXpAB5dG2reIhSLVLWJNwcB9sExTw2I/cRUvCuvl V02bxNO10PPMGI1b+LS+aUji9o7FP5JzMdRWh/HyOQAn/+RexTtBBNlmY77vNfHqf/ DVmSTjKqoiPUtjwJYNbx8isDVTljlm7Cv74RtWu0= Date: Wed, 12 Jun 2019 19:10:26 +0200 From: Greg Kroah-Hartman To: Joel Fernandes Cc: Qian Cai , Thomas Gleixner , Andrew Morton , Waiman Long , Zhong Jiang , linux-kernel@vger.kernel.org Subject: Re: [PATCH] lib: debugobjects: no need to check return value of debugfs_create functions Message-ID: <20190612171026.GB6986@kroah.com> References: <20190612153513.GA21082@kroah.com> <20190612165819.GA123863@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190612165819.GA123863@google.com> User-Agent: Mutt/1.12.0 (2019-05-25) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 12, 2019 at 12:58:19PM -0400, Joel Fernandes wrote: > On Wed, Jun 12, 2019 at 05:35:13PM +0200, Greg Kroah-Hartman wrote: > > When calling debugfs functions, there is no need to ever check the > > return value. The function can work or not, but the code logic should > > never do something different based on this. > > > > Cc: Qian Cai > > Cc: Thomas Gleixner > > Cc: Andrew Morton > > Cc: Waiman Long > > Cc: "Joel Fernandes (Google)" > > Cc: Zhong Jiang > > Cc: linux-kernel@vger.kernel.org > > Signed-off-by: Greg Kroah-Hartman > > --- > > lib/debugobjects.c | 14 ++------------ > > 1 file changed, 2 insertions(+), 12 deletions(-) > > > > diff --git a/lib/debugobjects.c b/lib/debugobjects.c > > index 55437fd5128b..2ac42286cd08 100644 > > --- a/lib/debugobjects.c > > +++ b/lib/debugobjects.c > > @@ -850,26 +850,16 @@ static const struct file_operations debug_stats_fops = { > > > > static int __init debug_objects_init_debugfs(void) > > { > > - struct dentry *dbgdir, *dbgstats; > > + struct dentry *dbgdir; > > > > if (!debug_objects_enabled) > > return 0; > > > > dbgdir = debugfs_create_dir("debug_objects", NULL); > > - if (!dbgdir) > > - return -ENOMEM; > > > > - dbgstats = debugfs_create_file("stats", 0444, dbgdir, NULL, > > - &debug_stats_fops); > > - if (!dbgstats) > > - goto err; > > + debugfs_create_file("stats", 0444, dbgdir, NULL, &debug_stats_fops); > > > One weirdness is, if dbgdir is ever NULL, then debugfs_create_file() may end > up creating the stats file in the root. Yes, but dbgdir can not be NULL. > In debugfs_create_file(): > /* If the parent is not specified, we create it in the root. > * We need the root dentry to do this, which is in the super > * block. A pointer to that is in the struct vfsmount that we > * have around. > */ > if (!parent) > parent = debugfs_mount->mnt_root; Yes, but debugfs_create_dir() will never return NULL. > But I guess that's not a major issue since its debugfs :-) So LGTM, Yup! > Reviewed-by: Joel Fernandes (Google) thanks for the review. greg k-h