Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp85697pxb; Tue, 5 Apr 2022 00:54:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTROeFVxMnOCarC8XUm1yn9WTRICD1Y5/AAzp+t5J2EkC0AXTHLmtn0X3sySy/L71vNuyl X-Received: by 2002:a63:68c8:0:b0:380:3fbd:2ec9 with SMTP id d191-20020a6368c8000000b003803fbd2ec9mr1856210pgc.608.1649145245107; Tue, 05 Apr 2022 00:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649145245; cv=none; d=google.com; s=arc-20160816; b=oBe8N4Htn+P51XSBB7NaBN5avxheRDDBpiyzE8XDU42em5/LXhO6RVfoGZ8K5Np8Df tnTlSAuInN2z+HyDNdAFIbY/Emxr9gsq4i3tKazgTAb4i7zCem6wApGhC5NUanWJslo8 FWFvVEM23GDB25Sq3TK640ixIDRxVNB/nEFs6goi64iZYyDXUp1QgaF5DdoYrFlz5+XD ZPuqYjWmCsz6D+TPA1G/m2fVgsqhiuBPbvyjWKSZfPQTgrTuW1Vv5uV5Lpvr+6vtTB1n 6ZyH/LAulmx/0Smi+WCzD/8/UUqaBhfJS5fvWhqWwAsf21TTCLIfdJrh22zdDcyWotDl c7yQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=Euu7t/hxv9zb3GsR4qSdg4v+2jm6d/KK4KSq0C2qHBM=; b=PmH0KEiNO1XsqzgjEWdWSSzSvhvEad0vanerEgHEvRhowwkGzvKzAGMG4JLRIHZdK5 ePNwKP9ie3SWooNeOuQqyMm0VDrE7opOpy1mnaFtZxT74mEhUalln62Z2wSmPF1dXjaE HS4G5VpJuN0GFc1GcvDHTtQ0XrcjMRSo3p/L3QJjwv3oIANHdhMg6GLZNPLSxmCCWVpc twtv6nuyLMyq3TAAHwC5ROTZfoaD9ev00YATiIGs04TRefblyNwoXRga9VF8+CmFTAUW xBtkOhTDDpC7CRJ2vqTiZ2akwS9FUEGPF+1aRY6FoN6mGhWQlsSjopCbcCDWPL4cjuf6 rEsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=X8YtQXq9; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu11-20020a17090b1b0b00b001bd14e01fc0si1203178pjb.174.2022.04.05.00.53.55; Tue, 05 Apr 2022 00:54:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@kernel.org header.s=k20201202 header.b=X8YtQXq9; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232476AbiDEHyf (ORCPT + 69 others); Tue, 5 Apr 2022 03:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232322AbiDEHyC (ORCPT ); Tue, 5 Apr 2022 03:54:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E9121EEEC for ; Tue, 5 Apr 2022 00:49:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 88ABD616DE for ; Tue, 5 Apr 2022 07:49:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC9ECC340EE; Tue, 5 Apr 2022 07:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649144952; bh=FsWGZRZU5luoFcJ8Wj2q+FnEHag6sXtG+zcjWXjN7P8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=X8YtQXq96B1J3ZAkb/S4eA0njiU95WZPOewAlV4RA6I8veRnAAOv1Jlri1nzaN+7u 6K1/WcL5JJbq8Vdmdl1T4fmaUSGDjbEzmZQWeh21SBNYK7d/RD5ksGNHwJN1i1Ak3l 4QpOwv0N+gXZ3gUE3LKxA/Pl/Pdd6ssyvZblsKxzx0evmwY6wPm+KJKU8PQowQ3JAY ERVorqCLWR2juZN99x3Yto/316s3Ke8+5wpOoAMLFzaeVPSZ3v/z7t224a/WUbs2AV z2IS6LHE04p+yVSL3qBT4BIgNIwa+A6KsfEARJ+HJ4a0P6IzKsyPcFtfm/qf+qeujG PbwemzEjRq1Yg== From: Kalle Valo To: Dan Carpenter , Aloka Dixit Cc: john@phrozen.org, ath11k@lists.infradead.org, linux-wireless@vger.kernel.org Subject: Re: [bug report] ath11k: add debugfs for TWT debug calls References: <20220301074905.GA13071@kili> Date: Tue, 05 Apr 2022 10:49:05 +0300 In-Reply-To: <20220301074905.GA13071@kili> (Dan Carpenter's message of "Tue, 1 Mar 2022 10:49:05 +0300") Message-ID: <8735isrmvi.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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-wireless@vger.kernel.org + aloka Dan Carpenter writes: > Hello John Crispin, > > The patch fe98a6137d03: "ath11k: add debugfs for TWT debug calls" > from Jan 31, 2022, leads to the following Smatch static checker > warning: > > drivers/net/wireless/ath/ath11k/debugfs.c:1642 ath11k_debugfs_add_interface() > warn: 'arvif->debugfs_twt' is an error pointer or valid > > drivers/net/wireless/ath/ath11k/debugfs.c > 1637 int ath11k_debugfs_add_interface(struct ath11k_vif *arvif) > 1638 { > 1639 if (arvif->vif->type == NL80211_IFTYPE_AP && !arvif->debugfs_twt) { > 1640 arvif->debugfs_twt = debugfs_create_dir("twt", > 1641 arvif->vif->debugfs_dir); > --> 1642 if (!arvif->debugfs_twt || IS_ERR(arvif->debugfs_twt)) { > 1643 ath11k_warn(arvif->ar->ab, > 1644 "failed to create directory %p\n", > 1645 arvif->debugfs_twt); > > The debugfs_create_dir() function never returns NULL. It's generally > not supposed to checked for errors. This code here looks like a > layering violation because it's trying to check if debugfs is already > registered. But the clean up code just unregisters on the first call. > Should it be ref counted or can the !arvif->debugfs_twt check be > removed? > > Also if the user deliberately disabled debugfs then this prints an error > message. > > 1646 arvif->debugfs_twt = NULL; > 1647 return -1; Please also use proper error values, not -1. > 1648 } > 1649 > 1650 debugfs_create_file("add_dialog", 0200, arvif->debugfs_twt, > 1651 arvif, &ath11k_fops_twt_add_dialog); > 1652 > 1653 debugfs_create_file("del_dialog", 0200, arvif->debugfs_twt, > 1654 arvif, &ath11k_fops_twt_del_dialog); > 1655 > 1656 debugfs_create_file("pause_dialog", 0200, arvif->debugfs_twt, > 1657 arvif, &ath11k_fops_twt_pause_dialog); > 1658 > 1659 debugfs_create_file("resume_dialog", 0200, arvif->debugfs_twt, > 1660 arvif, &ath11k_fops_twt_resume_dialog); > 1661 } > 1662 return 0; > 1663 } Aloka, you submitted this patch. Please take a look and fix the issues. -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches