Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp223688rwb; Wed, 14 Dec 2022 16:27:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qRL2OnATg/Y9tChkcZfktqPL4mPKWjjW1cAkB/E5+sVWkSD8Q4FuP/2LtDLPuRhUxjTG1 X-Received: by 2002:a17:906:128c:b0:7a9:fc17:eb4c with SMTP id k12-20020a170906128c00b007a9fc17eb4cmr22120292ejb.40.1671064072435; Wed, 14 Dec 2022 16:27:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671064072; cv=none; d=google.com; s=arc-20160816; b=qvQFhy/14UiZKXxead4NvLNWdERRDI2glPOuvVb0fW0+eFgZSij7gqDfDLYoR5QdnX ADwGsrGzoPu8vxpIKMHv4ykbx2qDlKMA5ZFZO0RFRoQeqBIz1+3QgvOoiBO3dYoomeQQ f2Z7TIa4RRTnRLfus4RFyb7zCa+sOqNgUo9UDfmvXRyAVW55EZLtRY9MBN3zkaSOV/k9 HpZveo1u8ygtLajUjoNBLSeRhLCKFp6ZW+aXcDWWRfBZSben/UgtPAa/Ke2VynirKup5 tkzcqZvxbL+2PRJVaSJNGkLecX+cqSvMh17fHvMWFdpEOsln4ebZyS2zFEXnJ5mNvsee njKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=yD9PICPiUNexEf6oBToH8CPTy9Uy6i+HLi2LtrhOcs0=; b=IKdlJUiAx40FL7PGww97Ju0b+fxc5fOGMIpmaepBUdFa7hdodfjxeWwkMrHCzPddWm meFuMOZBToEBMrf83iZJoSGKS0tJrc6q7rvdbncv/+p4jB5CyRDWR6DuXkg52c9BiAxz YeKE/rCeTDMKPh/ZHE7H6Ks44HDZi2T2kyPwQSaD4X6RaRieoy4M9R1Vnt/hNYnYMFX6 UBmIbrlvNTmzP3Kk3Mh9XG1KyF2lxjlr0nSDxeiom2VYCCKGTlsUYuZMSYWaPNkqHiUy sNFPc5UNeeJH0nW6FJ0w2esFcBgtyXu/URf3nJawVFqmpH9N6Tv3C5eh64+ZovC78UYS IzuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b=dCcYC88f; 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=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020a170906595900b007ad6a0afbc6si10487769ejr.7.2022.12.14.16.27.35; Wed, 14 Dec 2022 16:27:52 -0800 (PST) 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=@baikalelectronics.ru header.s=post header.b=dCcYC88f; 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=REJECT sp=REJECT dis=NONE) header.from=baikalelectronics.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230082AbiLNXy2 (ORCPT + 69 others); Wed, 14 Dec 2022 18:54:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbiLNXxR (ORCPT ); Wed, 14 Dec 2022 18:53:17 -0500 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1AF6A4875F; Wed, 14 Dec 2022 15:53:16 -0800 (PST) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id A7766E0ED6; Thu, 15 Dec 2022 02:53:15 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= baikalelectronics.ru; h=cc:cc:content-transfer-encoding :content-type:content-type:date:from:from:in-reply-to:message-id :mime-version:references:reply-to:subject:subject:to:to; s=post; bh=yD9PICPiUNexEf6oBToH8CPTy9Uy6i+HLi2LtrhOcs0=; b=dCcYC88fWgfT /x/DKGudP0hWLmOOekeSNIOR6BPpb0aPrZDH5RtcNvAN+KFOXDfoy/b5fvuWBsHZ sIMWaNQtJA+IxuHhlBa55HL/BEWvKws79t899zdGlJxWhX8LlVhTJ6cBoGd0Uq8G FanHELsqdKXYWGy9nT9gqibgXrgTkaI= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id 9972BE0E6B; Thu, 15 Dec 2022 02:53:15 +0300 (MSK) Received: from localhost (10.8.30.6) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 15 Dec 2022 02:53:15 +0300 From: Serge Semin To: Gustavo Pimentel , Vinod Koul , Rob Herring , Bjorn Helgaas , Lorenzo Pieralisi , Cai Huoqing , Robin Murphy , Jingoo Han , Frank Li , Manivannan Sadhasivam CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , caihuoqing , Yoshihiro Shimoda , , , Subject: [PATCH v7 11/25] dmaengine: dw-edma: Stop checking debugfs_create_*() return value Date: Thu, 15 Dec 2022 02:52:51 +0300 Message-ID: <20221214235305.31744-12-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221214235305.31744-1-Sergey.Semin@baikalelectronics.ru> References: <20221214235305.31744-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.8.30.6] X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS 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 First of all they never return NULL. So checking their return value for being not NULL just pointless. Secondly the DebugFS subsystem is designed in a way to be used as simple as possible. So if one of the debugfs_create_*() method in a hierarchy fails, the following methods will just silently return the passed erroneous parental dentry. Finally the code is supposed to be working no matter whether anything DebugFS-related fails. So in order to make code simpler and DebugFS-independent let's drop the debugfs_create_*() methods return value checking in the same way as the most of the kernel drivers do. Note in order to preserve some memory space we suggest to skip the DebugFS nodes initialization if the file system in unavailable. Signed-off-by: Serge Semin Reviewed-by: Manivannan Sadhasivam Tested-by: Manivannan Sadhasivam Acked-by: Vinod Koul --- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c index 8e61810dea4b..6e7f3ef60ca7 100644 --- a/drivers/dma/dw-edma/dw-edma-v0-debugfs.c +++ b/drivers/dma/dw-edma/dw-edma-v0-debugfs.c @@ -100,9 +100,8 @@ static void dw_edma_debugfs_create_x32(const struct debugfs_entries entries[], int i; for (i = 0; i < nr_entries; i++) { - if (!debugfs_create_file_unsafe(entries[i].name, 0444, dir, - entries[i].reg, &fops_x32)) - break; + debugfs_create_file_unsafe(entries[i].name, 0444, dir, + entries[i].reg, &fops_x32); } } @@ -168,8 +167,6 @@ static void dw_edma_debugfs_regs_wr(struct dentry *dir) char name[16]; regs_dir = debugfs_create_dir(WRITE_STR, dir); - if (!regs_dir) - return; nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); @@ -184,8 +181,6 @@ static void dw_edma_debugfs_regs_wr(struct dentry *dir) snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i); ch_dir = debugfs_create_dir(name, regs_dir); - if (!ch_dir) - return; dw_edma_debugfs_regs_ch(®s->type.unroll.ch[i].wr, ch_dir); @@ -237,8 +232,6 @@ static void dw_edma_debugfs_regs_rd(struct dentry *dir) char name[16]; regs_dir = debugfs_create_dir(READ_STR, dir); - if (!regs_dir) - return; nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); @@ -253,8 +246,6 @@ static void dw_edma_debugfs_regs_rd(struct dentry *dir) snprintf(name, sizeof(name), "%s:%d", CHANNEL_STR, i); ch_dir = debugfs_create_dir(name, regs_dir); - if (!ch_dir) - return; dw_edma_debugfs_regs_ch(®s->type.unroll.ch[i].rd, ch_dir); @@ -273,8 +264,6 @@ static void dw_edma_debugfs_regs(void) int nr_entries; regs_dir = debugfs_create_dir(REGISTERS_STR, dw->debugfs); - if (!regs_dir) - return; nr_entries = ARRAY_SIZE(debugfs_regs); dw_edma_debugfs_create_x32(debugfs_regs, nr_entries, regs_dir); @@ -285,6 +274,9 @@ static void dw_edma_debugfs_regs(void) void dw_edma_v0_debugfs_on(struct dw_edma *_dw) { + if (!debugfs_initialized()) + return; + dw = _dw; if (!dw) return; @@ -294,8 +286,6 @@ void dw_edma_v0_debugfs_on(struct dw_edma *_dw) return; dw->debugfs = debugfs_create_dir(dw->name, NULL); - if (!dw->debugfs) - return; debugfs_create_u32("mf", 0444, dw->debugfs, &dw->chip->mf); debugfs_create_u16("wr_ch_cnt", 0444, dw->debugfs, &dw->wr_ch_cnt); -- 2.38.1