Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp2707699rwj; Mon, 19 Dec 2022 07:57:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXvbVPyNrGvlULuvtb+2SKERrhuk66ZDeh2+7fvG7IPef8zhxoCzwtem6+x3/qOmTF0qnYcn X-Received: by 2002:a05:6300:8181:b0:a5:6ed:669f with SMTP id bt1-20020a056300818100b000a506ed669fmr10183919pzc.2.1671465438183; Mon, 19 Dec 2022 07:57:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671465438; cv=none; d=google.com; s=arc-20160816; b=pFexFZqr4ewwd7N6ItxZfsRtY2iqMnIP+TrX6cfP97mii4495Kek3ZxGf6B8jh5cnt fp3IwJuF4mq5OgCzIAY3+r61ISkSEph2Br7DNBqwqg8XiryVrJwZT9P3ljJB+9OCIvMu RBO+31dSZ8f3qf7wVB5SFxCgfW/jrNBYCFcf4OAtOx7LV2NcvL1bde9cS6aHuApygUkp 3CN00wNeUb/xWnnA9q0llkiIDakSqmmMV9e/vZjcr1+bgvWSGnVDnhcqcga2bB1DN/1+ ZuNJ7G88hWvYeb2y+wIb9/CYj4lo3WH06zzHJ9e5LTVITZ2i5WrZmXa+q5YDalvEsuaT bGkw== 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=qjYxo8WwoxYuuDWLO/x77eyoF6vI06gP7wqdfD4WBz+qhiGTBkovFwwL0/TlrI0gZg zD1aUzMFi/kPz1RW20XSpy5HyzojA81i9WBjltuKcpaqAsrAllzR1ssis61zjmJ7rT6/ 9L9cS3eToCcpS4WNhwAT+71pb0naSjjllHa3aWHafh8kLQhEkQyVgshg89frMGAmIpdN qHWJFnJJ5kqc87flR5YU04Z2x/7i5QcJr1NDJMbexpjfb6Cu6xCQ7UbqXZjtHVi+yFD5 2vmV222+p28AXyCef0lwavgBwpmKMrwW56DRlV56nfZ/dQrHJO9tPxbQlA83qloPpPLp v2hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baikalelectronics.ru header.s=post header.b="jqJTY/QE"; 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 s25-20020a634519000000b004795b00f71esi10691102pga.468.2022.12.19.07.57.08; Mon, 19 Dec 2022 07:57:18 -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="jqJTY/QE"; 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 S232409AbiLSOsq (ORCPT + 71 others); Mon, 19 Dec 2022 09:48:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231520AbiLSOrW (ORCPT ); Mon, 19 Dec 2022 09:47:22 -0500 Received: from post.baikalelectronics.com (post.baikalelectronics.com [213.79.110.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 87C27FE; Mon, 19 Dec 2022 06:47:09 -0800 (PST) Received: from post.baikalelectronics.com (localhost.localdomain [127.0.0.1]) by post.baikalelectronics.com (Proxmox) with ESMTP id 27DEEE0EBA; Mon, 19 Dec 2022 17:47:09 +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=jqJTY/QEIE1A 4OHV0J/7NajqPPTM+UHuZJpSOsC4tRJIyRrLFUkJGoist3d4X4iXchEn5K8r9Hon rA6q4KcbEeLhPAY/djPfkV/7p/t3Z8keqGElqBIBjnIkCiANdRfVPGWsURTAiiJn RdydBu3qEwytqqUNPLFwnMbvgZSmY0o= Received: from mail.baikal.int (mail.baikal.int [192.168.51.25]) by post.baikalelectronics.com (Proxmox) with ESMTP id 1CED1E0E70; Mon, 19 Dec 2022 17:47:09 +0300 (MSK) Received: from localhost (10.8.30.14) by mail (192.168.51.25) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Mon, 19 Dec 2022 17:47:08 +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 v8 11/26] dmaengine: dw-edma: Stop checking debugfs_create_*() return value Date: Mon, 19 Dec 2022 17:46:42 +0300 Message-ID: <20221219144658.26620-12-Sergey.Semin@baikalelectronics.ru> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221219144658.26620-1-Sergey.Semin@baikalelectronics.ru> References: <20221219144658.26620-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.8.30.14] 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