From: Dan Carpenter <dan.carpenter@oracle.com>
To: john@phrozen.org
Cc: ath11k@lists.infradead.org, linux-wireless@vger.kernel.org
Subject: [bug report] ath11k: add debugfs for TWT debug calls
Date: Tue, 1 Mar 2022 10:49:05 +0300 [thread overview]
Message-ID: <20220301074905.GA13071@kili> (raw)
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;
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 }
regards,
dan carpenter
next reply other threads:[~2022-03-01 7:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-01 7:49 Dan Carpenter [this message]
2022-04-05 7:49 ` [bug report] ath11k: add debugfs for TWT debug calls Kalle Valo
2022-04-07 17:32 ` Aloka Dixit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220301074905.GA13071@kili \
--to=dan.carpenter@oracle.com \
--cc=ath11k@lists.infradead.org \
--cc=john@phrozen.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).