[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <alpine.LFD.2.20.1607291138100.3349@schleppi>
Date: Fri, 29 Jul 2016 11:46:08 +0200 (CEST)
From: Sebastian Ott <sebott@...ux.vnet.ibm.com>
To: Julia Lawall <julia.lawall@...6.fr>
cc: Amitoj Kaur Chawla <amitoj1606@...il.com>,
Gerald Schaefer <gerald.schaefer@...ibm.com>,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] s390/pci: Remove unnecessary if condition
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@...leppi 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-
Regards,
Sebastian
Powered by blists - more mailing lists