Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4480219rwd; Tue, 23 May 2023 08:14:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7X1hTvBJLsOoLAJTKxgkR8AjrgHpTm6KUxYyGKvPXNm16gO9txSC7NhYU8X6YbZwxZMW8p X-Received: by 2002:a05:6a00:3924:b0:64d:5f1d:3d77 with SMTP id fh36-20020a056a00392400b0064d5f1d3d77mr10144978pfb.34.1684854855479; Tue, 23 May 2023 08:14:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684854855; cv=none; d=google.com; s=arc-20160816; b=ILMtcWcsLP1pAtgvZQCT0RuZaNVEoFoR1ig4kVgiUq9Jnr+T035T0DFSdL8iD3NmDL ObB0Drk5OlOYs2akG+R1R0yjfOMA0oc+ch/PZ0GifTrKUvAEv0XqMnMt0A90hwErxRrv CbXEPQZzmnuuhtDdzUJwgSyWYrrZXQ97zszu5rOUM0+KQOJujippfh3diEWuwYm44QGM w8UEN5V1ZntG2BiEM739yPLbUHeuKD1SQ12ilg6FF9f+AfvtpISCoUDQZ7osoS7Q22ey nzjZ1Smku4QIxYoj4JircCEvEXZgmZvCHEtAI8v/wzrUc6ekFDRxMnLaGPOLAjHEnqnP ZlSQ== 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=/1Wj0P6YeefVDWUhmrWZwCaqFzfv9dXPwxlScY7Er8M=; b=hM1Adzo4UfeLhXKEJ5VScrJKYRhgbGJOGSPFa4AqG641Uo9KF9R0UIbuIKa2INOOLI hlw3q63+Qxm4jvwRnUhT2JNxT0H3Xx+GfChZDEIi5lrB/O8E72QGFzZZ/zMw11eA6EdM Ns21Bn8mnwn5xzH8U1R1FBm5dgk7U6/W3xpY9F0F5cqdhwu0Qq7ts2/kXFpzsPy2zkjO 4AomFqhRTbjKOaC6fmcbiDy0/rkHkh2boXWw8w4AowddVZzCsxabpTasJxrJijPT4yEu xp95LvMYcFBZBz3t1NzsqCpKQvqSINP7XXkMMNaVkmoUYljS3iBn5zMReVrmGnoQgeAw 3kHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=amAVpLeJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a056a00004500b0062d7d3c6cadsi1982017pfk.333.2023.05.23.08.14.00; Tue, 23 May 2023 08:14:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=amAVpLeJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237227AbjEWO5M (ORCPT + 99 others); Tue, 23 May 2023 10:57:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237052AbjEWO5L (ORCPT ); Tue, 23 May 2023 10:57:11 -0400 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB47CFA for ; Tue, 23 May 2023 07:57:09 -0700 (PDT) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-3f60410106cso18148245e9.1 for ; Tue, 23 May 2023 07:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684853828; x=1687445828; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/1Wj0P6YeefVDWUhmrWZwCaqFzfv9dXPwxlScY7Er8M=; b=amAVpLeJyPwKhmefM8/EOAHIHLVYlyiJwOdyk6pFO51tvPzhlvX3vOOTggg8tP73YP xzBcgusJeBauUJv950RurKmsemJ2NIovZeXxHoSjgHPPXKwDHJOzF7ubHJypOLSO/94t fxh1gxyVKCabr2VdjelC711MlJn8t3xT0VqLz+t4luwAUZOkRnPLHWHNHnbv8WtviXub l9BC48BpOuZQWtJmqRXoSBdlhBJYqo3gS1F2xU4Q12EYp3piOG5NNY0Oik+Dv+wf1mUP d6DAqS4DQ+uhq4ZkhN31RUWDwQxpRS2MDrbKQQxtO7Ay2z84UfxDTggFZK1hQIE7NH7c Wm3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684853828; x=1687445828; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/1Wj0P6YeefVDWUhmrWZwCaqFzfv9dXPwxlScY7Er8M=; b=SVu4asozWogQ5jfhq0rMRHPmQ+0OhByhCD1KdqKXTShoevTXtCdluwRI4a/YTeXfXv X9631GNm1bhI2EoyK1vaGnyNvMOf7MkTJnxK/tVFV/guy76CltpNbwoKX3KlQjQP8sUN 1z28fSr2JNGCgfdMOiPRP7DCwCUMncksaHbaViZfn5Dtsm3s82AtW3lGYX9EzTH8paQG p/aXRqh1Wpcx5vZdeFFRJDHG1MWAfL5x/SW/Mjjegns3ei0GhjGR9YD6M+00xV0BYXE7 m3pOMuf6Ko846z0KXW4zRww3E5m4bLB4aeLYNez+ZkgOf+Bq7R5Ic+L+6+/vxJ2a02s5 Q0Ww== X-Gm-Message-State: AC+VfDxqtnzapHgrvNRdGs0AHJlEptwL7NI6Ye35kG33B1TP5qucDBtd h4x5nPDqvCQs5bpiNCl9OrMbuA== X-Received: by 2002:a5d:4e8c:0:b0:306:37ec:656c with SMTP id e12-20020a5d4e8c000000b0030637ec656cmr10823357wru.66.1684853828416; Tue, 23 May 2023 07:57:08 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id n1-20020adfe781000000b002c54c9bd71fsm11388835wrm.93.2023.05.23.07.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:57:05 -0700 (PDT) Date: Tue, 23 May 2023 17:57:03 +0300 From: Dan Carpenter To: Tomas Henzl Cc: Dongliang Mu , Jing Xu , Sathya Prakash , Sreekanth Reddy , Suganath Prabu Subramani , "James E.J. Bottomley" , "Martin K. Petersen" , hust-os-kernel-patches@googlegroups.com, MPT-FusionLinux.pdl@broadcom.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers: mpt3sas: mpt3sas_debugfs: return value check of `mpt3sas_debugfs_root` Message-ID: <3c4b372f-db4b-43b4-b5ab-7f4860cf6f20@kili.mountain> References: <20230423122535.31019-1-U202112064@hust.edu.cn> <6e69b57c-80ae-8b6e-cb5f-9e05da46ecd6@redhat.com> <1484408f-f68e-4354-ab59-56af9cd1ef14@kili.mountain> <81d236bb-3913-4eef-bf71-6d17535d6d79@kili.mountain> <892bc614-9e2e-904b-29e0-62daeb855f79@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <892bc614-9e2e-904b-29e0-62daeb855f79@redhat.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 23, 2023 at 04:48:12PM +0200, Tomas Henzl wrote: > On 5/8/23 16:38, Dan Carpenter wrote: > > On Mon, May 08, 2023 at 09:40:41PM +0800, Dongliang Mu wrote: > >>>>> diff --git a/drivers/scsi/mpt3sas/mpt3sas_debugfs.c b/drivers/scsi/mpt3sas/mpt3sas_debugfs.c > >>>>> index a6ab1db81167..c92e08c130b9 100644 > >>>>> --- a/drivers/scsi/mpt3sas/mpt3sas_debugfs.c > >>>>> +++ b/drivers/scsi/mpt3sas/mpt3sas_debugfs.c > >>>>> @@ -99,8 +99,6 @@ static const struct file_operations mpt3sas_debugfs_iocdump_fops = { > >>>>> void mpt3sas_init_debugfs(void) > >>>>> { > >>>>> mpt3sas_debugfs_root = debugfs_create_dir("mpt3sas", NULL); > >>>>> - if (!mpt3sas_debugfs_root) > >>>>> - pr_info("mpt3sas: Cannot create debugfs root\n"); > >>>> Hi Jing, > >>>> most drivers just ignore the return value but here the author wanted to > >>>> have the information logged. > >>>> Can you instead of removing the message modify the 'if' condition so it > >>>> suits the author's intention? > >>> > >>> This code was always just wrong. > >>> > >>> The history of this is slightly complicated and boring. These days it's > >>> harmless dead code so I guess it's less bad than before. > >> > >> Hi Dan and Tomas, > >> > >> Any conclusion about this patch? The student Jing Xu is not sure about how > >> to revise this patch. > > > > The correct fix is to delete the code. > > > > Debugfs code has error checking built in and was never supposed to be > > checked for errors in normal driver code. > > > > Originally, debugfs returned a mix of error pointers and NULL. In the > > kernel, when you have a mix of error pointers and NULL, then the NULL > > means that the feature has been disabled deliberately. It's not an > > error, we should not print a message. > > > > So a different, correct-ish way to write write debugfs error handling > > was to say: > > > > mpt3sas_debugfs_root = debugfs_create_dir("mpt3sas", NULL); > > if (IS_ERR(mpt3sas_debugfs_root)) > > return PTR_ERR(mpt3sas_debugfs_root); > I'm fine with this as well, I could wish we get a fix for the exact same > case of debugfs_create_dir in mpt3sas_setup_debugfs and ideally all the > debugfs_create* in mpt3sas_debugfs.c in a single patch. But this patch > is ok even if that wasn't possible. > tomash No, you didn't read until the end. That will break the driver badly. This *used* to be a correct-ish way that *used* to work but it was never the what Greg wanted. So to discourage people from doing it, Greg made it *impossible* to check for if debugfs has failed. Literally, the only correct thing to do now is to delete the debugfs checking. regards, dan carpenter