Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2780471pxa; Fri, 7 Aug 2020 22:45:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY5AHJGmM92Kw6W7QWkdTvwhNnLJEdRLwFbk1b59p6boXNS7yJoNvRq8gnxrj/lXiavxmf X-Received: by 2002:a05:6402:758:: with SMTP id p24mr11913678edy.35.1596865520507; Fri, 07 Aug 2020 22:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596865520; cv=none; d=google.com; s=arc-20160816; b=J0j7N6frEdCJbCbvHafhemicuR5udIHVtuDbjoDn2Gp5vlM+WxrrRt2Cm38uQrWrGB Uy7aFlKtC69//wAqngxPFX8QjjK+8btA3s7WHMQT2r+ftJ8Y1KTlfFxRg8T6PgtuZeSm +4/Xn9ffc9SQG/qLLGJRvU+qRmFLV6fpObrQg6HtpS0H/CW1RZK8UexeZeun6LU7+1J6 QuLi/MUypsRpg3RMF8I0q2HfYi+yzyP9yNvBlEEixKztgsTyEi72A57AUpnvQu1DwINJ 5+k2hvPcFLu/oWEufUb1JPmGNxceHFzPBy9GmOCF/I9N/EOtpmGtL9HKQlAknhE5vSQW XyJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=W1qWu37tPoRO/OjnDgp43LdS0S7xKN6Or8MZmcdsxrM=; b=DQW8hPJUDHtIwsfg18vjYL5m5alYy2rzlhCokbN6nzsj9O+CZKOaZLTn4Z8pkFEarN hKdc/hj5uCzXqrZyOX5mIX7eJvUVaEQgZhI1tA1y4JKx14hcxXRYWZZz0jURqqQzfhqJ ZYUot2gaYpiektiKRSQqXrC3omnx9IctMp60Zbf2eyjJmj21te+YRG96Xf6pfZj2H0jG iEWD98g+7xF7JSg5YasNcYFC59RqwDeiIs5yBwQJPnC1tMFtcfhsu4oBJibOChSvHbZw n+ycGbKlyET2gyAfjub/ooECSMoVIN+6C6bYXgkbZqKoM/0kS1JerSBe7/WFBay3Vb8y E9Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h4Hfvatd; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si9072276edv.581.2020.08.07.22.44.57; Fri, 07 Aug 2020 22:45:20 -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=h4Hfvatd; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726338AbgHHFlr (ORCPT + 99 others); Sat, 8 Aug 2020 01:41:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:54952 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725786AbgHHFlr (ORCPT ); Sat, 8 Aug 2020 01:41:47 -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 832172177B; Sat, 8 Aug 2020 05:41:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596865307; bh=zZB6wpjl7y81v9umrlk/yZ28yBq8cLqHYj1M+cdlj+0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h4HfvatdyE43mb3wFMw+wqp6RtzNI6q2/SaDnBcKMlSABzwXKWCbuvVah+VYtA3GG qQIhZjCXs6wp7ZT2j62m8Ogn7+G93uDhDlo26bH239nay+7SP26WOwqMWrAPf+XiEs z/oOjo7rCaEPyyTyrpBCNq3ileswcpwOlRsTUgS4= Date: Sat, 8 Aug 2020 07:41:43 +0200 From: Greg KH To: Jonathan Adams Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Jim Mattson , David Rientjes , Justin TerAvest Subject: Re: [RFC PATCH 1/7] core/metricfs: Create metricfs, standardized files under debugfs. Message-ID: <20200808054143.GB1037591@kroah.com> References: <20200807212916.2883031-1-jwadams@google.com> <20200807212916.2883031-2-jwadams@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200807212916.2883031-2-jwadams@google.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org debugfs interaction nits: On Fri, Aug 07, 2020 at 02:29:10PM -0700, Jonathan Adams wrote: > +static struct dentry *metricfs_init_dentry(void) > +{ > + static int once; > + > + if (d_metricfs) > + return d_metricfs; > + > + if (!debugfs_initialized()) > + return NULL; > + > + d_metricfs = debugfs_create_dir("metricfs", NULL); > + > + if (!d_metricfs && !once) { As it is impossible for d_metricfs to ever be NULL, why are you checking it? > + once = 1; > + pr_warn("Could not create debugfs directory 'metricfs'\n"); There is a pr_warn_once I think, but again, how can this ever trigger? > + return NULL; > + } > + > + return d_metricfs; > +} > + > +/* We always cast in and out to struct dentry. */ > +struct metricfs_subsys { > + struct dentry dentry; > +}; > + > +static struct dentry *metricfs_create_file(const char *name, > + mode_t mode, > + struct dentry *parent, > + void *data, > + const struct file_operations *fops) > +{ > + struct dentry *ret; > + > + ret = debugfs_create_file(name, mode, parent, data, fops); > + if (!ret) > + pr_warn("Could not create debugfs '%s' entry\n", name); As ret can never be NULL, why check? There is no need to ever check debugfs return values, just keep on going, that's the design of it. thanks, greg k-h