Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4713320rwd; Tue, 23 May 2023 11:19:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7vUfYMzZih3XW7E7IZXTEQQKJJf2nTMDDGU3Z5EkwfqkO7flvLZWNnCOZvaVfhAtHwqEq9 X-Received: by 2002:a17:902:e5c8:b0:1aa:e425:2527 with SMTP id u8-20020a170902e5c800b001aae4252527mr15459518plf.21.1684865946515; Tue, 23 May 2023 11:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684865946; cv=none; d=google.com; s=arc-20160816; b=x9Rbqq7AlLJtm145jTS5coU2V2bDfEOjMEhBtRifB0zd2XnubIB2H3lwB+PrssApVN jj7pi+7TxgrwWFEa/KLjofBhCr6XppBV40dXscLnxFMxM3Qi09coXS1J3GUPHX9Kb+em /3z4qAD64O+9MS+DF/zvk8C35k+iHXsZXveoGVuzdHLsmdzUUufuPNwYrNipBYAS0vGh vTTGaeXawu25aP41Gk54JoGpioIecKDvD0kZ3fQjwKddaD2/RQDzOXZtZ698xCFoxR+B BD3i8fEiQlzkINkKPI7jMMZdAir4hP6gqhelCNmHi8Pj+06TICaEQKox+/tj8fJRI+IL bChA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=4j97EwXZbpGeydneOiYzyqIdUbofrkUoFZFV5L4oKTY=; b=UT9Yfo0Qz/4N3bPRvv8QcSb7y/LmVw5wC6foGomDvpO3OpCrA+guZEckGknT38orR6 TlH387XkBc/87E95OyWN+rHMVpRiGN3G+DjluF2/a8vEvw7FQYeIm0qzJ04BRcrEQ6Qu RHN6VUSUHso8koeUhsvu94Ypr1e/b3p6nWXutv+W4VWEYhIy/pi8AZviMXa9CtJiBetb /eB1CkKTJEu07F0W/sUCSLg91gEvwu61f1AReqk0yH/56N1cF33ycmwagqeKsjIvoMkV hAhGM+m3aenZsctxW8v/OScmiqQdhH4QPD+zIY7plVx4xKSZCvX2p7FHsd71WlqgU7+q +NKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="E/XaKhBl"; 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=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a63340d000000b0050c0a7a2742si1187484pga.350.2023.05.23.11.18.54; Tue, 23 May 2023 11:19:06 -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=@redhat.com header.s=mimecast20190719 header.b="E/XaKhBl"; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237883AbjEWR4w (ORCPT + 99 others); Tue, 23 May 2023 13:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237833AbjEWR4u (ORCPT ); Tue, 23 May 2023 13:56:50 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 316E4C5 for ; Tue, 23 May 2023 10:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684864566; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4j97EwXZbpGeydneOiYzyqIdUbofrkUoFZFV5L4oKTY=; b=E/XaKhBlcT6aLG9xJf/sQTdB/WrgEjssTGBDZE+oA5gyHE/jEgwBewazRLnYz7IFC9LlNa Rq4f+sfQ4NBsMClCEyfbqfzhFIdfPMuVniV/l8lB6f+YodCr3e1k2QK9i6w8DNt5EbUaxh Yu3ttVf/MUCfSOlN6rZUz8hMfrD74To= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-93-CX6PDZAuNGWMjJetbYbzbg-1; Tue, 23 May 2023 13:56:05 -0400 X-MC-Unique: CX6PDZAuNGWMjJetbYbzbg-1 Received: by mail-ed1-f69.google.com with SMTP id 4fb4d7f45d1cf-513ddd8e39cso104473a12.2 for ; Tue, 23 May 2023 10:56:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684864564; x=1687456564; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4j97EwXZbpGeydneOiYzyqIdUbofrkUoFZFV5L4oKTY=; b=I466cbW8RD0cnrYD2mJuRgzydiC7A/9KDTBPUajsQXz8Et5+NXznPaHAKa01pfM8BD W5A3ZVMDLrCzOJzJHvIXZe9HboVM2wRaxiQx82yKCOAASEuPUjwgZSABIYOeu6pCnWU5 E09QS4k/EalDfwQcxrUqM92hrgj5Mf6X2L82HsWJclc77lBPs2gVca0Od/lq5TsAqrck 0dR2LIm2vP/GaM8AapSAd3wEMoLe/ajnxGNb/vaE+bc28s6Ng77j62dAz1qdgy0FppJe tiYIsZx01iCvi3HW6q0FPOngBOSoiuL8/LJUfu7i5JIWPcsI7V9qQNUrODHhQXG4FKne iLDQ== X-Gm-Message-State: AC+VfDz6RkmuIPIv4lf1jusVg/NRfXNn97JDycj+LEjtFCcxyJwXy/Jq FbMfS1K2zqL2hSY7l8pAtO78zNgR9ixaRm8Stf5ziapyzyeJ6LBQJUAH3KiGm1GXgvsbb73POhf 5DYl/jDkG3+lFhzCArQ0pdHsn X-Received: by 2002:aa7:d397:0:b0:50b:d270:6b6f with SMTP id x23-20020aa7d397000000b0050bd2706b6fmr13033730edq.4.1684864564241; Tue, 23 May 2023 10:56:04 -0700 (PDT) X-Received: by 2002:aa7:d397:0:b0:50b:d270:6b6f with SMTP id x23-20020aa7d397000000b0050bd2706b6fmr13033713edq.4.1684864563964; Tue, 23 May 2023 10:56:03 -0700 (PDT) Received: from [192.168.0.107] (ip4-83-240-118-160.cust.nbox.cz. [83.240.118.160]) by smtp.gmail.com with ESMTPSA id c9-20020aa7c989000000b0050b2f588db6sm4190270edt.16.2023.05.23.10.56.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 23 May 2023 10:56:03 -0700 (PDT) Message-ID: <461c6576-71df-c16a-3c4f-4691ae84064f@redhat.com> Date: Tue, 23 May 2023 19:56:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] drivers: mpt3sas: mpt3sas_debugfs: return value check of `mpt3sas_debugfs_root` Content-Language: en-US To: Dan Carpenter 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 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> <3c4b372f-db4b-43b4-b5ab-7f4860cf6f20@kili.mountain> From: Tomas Henzl In-Reply-To: <3c4b372f-db4b-43b4-b5ab-7f4860cf6f20@kili.mountain> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham 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 5/23/23 16:57, Dan Carpenter wrote: > 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. I put my comment in on a wrong place I meant the original patch without the check, sorry for the confusion. The only thing I'd like to see is to have corrected all debugfs_create* and that is also optional. > > regards, > dan carpenter > >