From: Julia Lawall <julia.lawall@lip6.fr>
To: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>,
Amitoj Kaur Chawla <amitoj1606@gmail.com>,
Gerald Schaefer <gerald.schaefer@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] s390/pci: Remove unnecessary if condition
Date: Mon, 1 Aug 2016 08:39:32 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.10.1608010838030.3078@hadrien> (raw)
In-Reply-To: <alpine.LFD.2.20.1607291138100.3349@schleppi>
On Fri, 29 Jul 2016, Sebastian Ott wrote:
> On Fri, 29 Jul 2016, Julia Lawall wrote:
> > On Fri, 29 Jul 2016, Sebastian Ott wrote:
> > > On Fri, 29 Jul 2016, Amitoj Kaur Chawla wrote:
> > > > Remove unnecessary error handling because the only failure value that
> > > > can be returned is NULL and so the test can never be true.
> > > >
> > > > The Coccinelle semantic patch used to make this change is as follows:
> > > > @@
> > > > expression e;
> > > > @@
> > > >
> > > > e = debugfs_create_file(...);
> > > > - if(IS_ERR(e)) { e = NULL; }
> > >
> > > Nope. For !CONFIG_DEBUG_FS debugfs_create_file returns an ERR_PTR.
> >
> > Clicking around in lxr doesn't show that, but perhaps an alternative
> > definition is overlooked?
>
> It looks that way.
>
>
> [sebott@schleppi linux]$ git grep -W "debugfs_create_file(" include/linux/debugfs.h
> include/linux/debugfs.h:struct dentry *debugfs_create_file(const char *name, umode_t mode,
> include/linux/debugfs.h- struct dentry *parent, void *data,
> include/linux/debugfs.h- const struct file_operations *fops);
> --
> include/linux/debugfs.h:static inline struct dentry *debugfs_create_file(const char *name, umode_t mode,
> include/linux/debugfs.h- struct dentry *parent, void *data,
> include/linux/debugfs.h- const struct file_operations *fops)
> include/linux/debugfs.h-{
> include/linux/debugfs.h- return ERR_PTR(-ENODEV);
> include/linux/debugfs.h-}
> include/linux/debugfs.h-
Thanks for the pointer. I guess that if the result of debugfs_create_file
is actully dereferenced, then both test should be present, eg:
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
ent = debugfs_create_file(name,
S_IFREG | S_IRUGO, root,
ring, &amdgpu_debugfs_ring_fops);
if (IS_ERR(ent))
return PTR_ERR(ent);
i_size_write(ent->d_inode, ring->ring_size + 12);
This problem seems to only occur in this directory.
thanks,
julia
prev parent reply other threads:[~2016-08-01 6:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-29 8:31 [PATCH] s390/pci: Remove unnecessary if condition Amitoj Kaur Chawla
2016-07-29 8:39 ` Sebastian Ott
2016-07-29 8:46 ` Julia Lawall
2016-07-29 9:46 ` Sebastian Ott
2016-08-01 6:39 ` Julia Lawall [this message]
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=alpine.DEB.2.10.1608010838030.3078@hadrien \
--to=julia.lawall@lip6.fr \
--cc=amitoj1606@gmail.com \
--cc=gerald.schaefer@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--cc=sebott@linux.vnet.ibm.com \
/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