From: Dan Carpenter <dan.carpenter@oracle.com>
To: Stephen Boyd <swboyd@chromium.org>
Cc: Abhinav Kumar <abhinavk@codeaurora.org>,
dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
freedreno@lists.freedesktop.org, robdclark@gmail.com,
seanpaul@chromium.org, nganji@codeaurora.org,
aravindh@codeaurora.org, tanmay@codeaurora.org,
khsieh@codeaurora.org
Subject: Re: [PATCH] drm/msm/dp: Fix warnings reported by kbot in DP driver
Date: Fri, 5 Mar 2021 10:23:50 +0300 [thread overview]
Message-ID: <20210305072350.GF2222@kadam> (raw)
In-Reply-To: <161492735848.1478170.885416005935439120@swboyd.mtv.corp.google.com>
On Thu, Mar 04, 2021 at 10:55:58PM -0800, Stephen Boyd wrote:
> > @@ -368,44 +368,21 @@ static int dp_debug_init(struct dp_debug *dp_debug, struct drm_minor *minor)
> > int rc = 0;
> > struct dp_debug_private *debug = container_of(dp_debug,
> > struct dp_debug_private, dp_debug);
> > - struct dentry *file;
> > - struct dentry *test_active;
> > - struct dentry *test_data, *test_type;
> >
> > - file = debugfs_create_file("dp_debug", 0444, minor->debugfs_root,
> > + debugfs_create_file("dp_debug", 0444, minor->debugfs_root,
> > debug, &dp_debug_fops);
> > - if (IS_ERR_OR_NULL(file)) {
> > - rc = PTR_ERR(file);
> > - DRM_ERROR("[%s] debugfs create file failed, rc=%d\n",
> > - DEBUG_NAME, rc);
> > - }
> >
> > - test_active = debugfs_create_file("msm_dp_test_active", 0444,
> > + debugfs_create_file("msm_dp_test_active", 0444,
> > minor->debugfs_root,
> > debug, &test_active_fops);
> > - if (IS_ERR_OR_NULL(test_active)) {
> > - rc = PTR_ERR(test_active);
> > - DRM_ERROR("[%s] debugfs test_active failed, rc=%d\n",
> > - DEBUG_NAME, rc);
> > - }
> >
> > - test_data = debugfs_create_file("msm_dp_test_data", 0444,
> > + debugfs_create_file("msm_dp_test_data", 0444,
> > minor->debugfs_root,
> > debug, &dp_test_data_fops);
> > - if (IS_ERR_OR_NULL(test_data)) {
> > - rc = PTR_ERR(test_data);
> > - DRM_ERROR("[%s] debugfs test_data failed, rc=%d\n",
> > - DEBUG_NAME, rc);
> > - }
> >
> > - test_type = debugfs_create_file("msm_dp_test_type", 0444,
> > + debugfs_create_file("msm_dp_test_type", 0444,
> > minor->debugfs_root,
> > debug, &dp_test_type_fops);
> > - if (IS_ERR_OR_NULL(test_type)) {
> > - rc = PTR_ERR(test_type);
> > - DRM_ERROR("[%s] debugfs test_type failed, rc=%d\n",
> > - DEBUG_NAME, rc);
> > - }
>
> Debugfs failures.
[ Update. I misunderstood what you were saying, and initially thought
you were critiquing the patch instead of the commit message. The
patch looks okay. Probably a lot of maintainers would prefer it
broken multiple chunks with one patch per class of warning. But I
already wrote this email and I love the sound of my own voice so I'm
sending it. - dan ]
The Smatch warning for this was that the error handling was slightly
off because debugfs_create_file() doesn't return NULL these days. But
really these functions are not supposed to be error checked in the
normal case.
If you do a `git grep -w debugfs_create_file` there are 1472 callers
and only 192 check. This is partly because Greg went through and did a
mass delete of error handling.
The way that debugfs works is if you fail to create a directory then
the debugfs_create_file will check if the root is an error pointer. So
passing it "handles" errors itself.
The one time where I've seen that checking for errors is essential is
if they driver dereferences the "test_data" dentry itself. That's
pretty uncommon.
[ So probably the commit message for this chunk should be:
Delete unnecessary debugfs error handling
Debugfs functions are not supposed to be checked in the normal case
so delete this code. Also it silences a Smatch warning that we're
checking for NULL when these functions only return error pointers. ]
regards,
dan carpenter
next prev parent reply other threads:[~2021-03-05 7:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-05 1:31 [PATCH] drm/msm/dp: Fix warnings reported by kbot in DP driver Abhinav Kumar
2021-03-05 6:55 ` Stephen Boyd
2021-03-05 7:23 ` Dan Carpenter [this message]
2021-03-05 18:38 ` [Freedreno] " abhinavk
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=20210305072350.GF2222@kadam \
--to=dan.carpenter@oracle.com \
--cc=abhinavk@codeaurora.org \
--cc=aravindh@codeaurora.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=khsieh@codeaurora.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=nganji@codeaurora.org \
--cc=robdclark@gmail.com \
--cc=seanpaul@chromium.org \
--cc=swboyd@chromium.org \
--cc=tanmay@codeaurora.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