Message ID | 20190810105734.GA27563@kroah.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | f5d4c647d0ddcf4ffcb9ff584fba87a976addcbd |
Headers | show |
Series | input: applespi: no need to check return value of debugfs_create functions | expand |
On Sat, Aug 10, 2019 at 12:57:34PM +0200, Greg Kroah-Hartman wrote: > When calling debugfs functions, there is no need to ever check the > return value. The function can work or not, but the code logic should > never do something different based on this. > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> > Cc: "Ronald Tschalär" <ronald@innovation.ch> > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Cc: Mao Wenan <maowenan@huawei.com> > Cc: linux-input@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Applied, thank you. > --- > drivers/input/keyboard/applespi.c | 30 ++++++------------------------ > 1 file changed, 6 insertions(+), 24 deletions(-) > > diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c > index 548737e7aeda..c822a5d2a85d 100644 > --- a/drivers/input/keyboard/applespi.c > +++ b/drivers/input/keyboard/applespi.c > @@ -1794,30 +1794,12 @@ static int applespi_probe(struct spi_device *spi) > > /* set up debugfs entries for touchpad dimensions logging */ > applespi->debugfs_root = debugfs_create_dir("applespi", NULL); > - if (IS_ERR(applespi->debugfs_root)) { > - if (PTR_ERR(applespi->debugfs_root) != -ENODEV) > - dev_warn(&applespi->spi->dev, > - "Error creating debugfs root entry (%ld)\n", > - PTR_ERR(applespi->debugfs_root)); > - } else { > - struct dentry *ret; > - > - ret = debugfs_create_bool("enable_tp_dim", 0600, > - applespi->debugfs_root, > - &applespi->debug_tp_dim); > - if (IS_ERR(ret)) > - dev_dbg(&applespi->spi->dev, > - "Error creating debugfs entry enable_tp_dim (%ld)\n", > - PTR_ERR(ret)); > - > - ret = debugfs_create_file("tp_dim", 0400, > - applespi->debugfs_root, applespi, > - &applespi_tp_dim_fops); > - if (IS_ERR(ret)) > - dev_dbg(&applespi->spi->dev, > - "Error creating debugfs entry tp_dim (%ld)\n", > - PTR_ERR(ret)); > - } > + > + debugfs_create_bool("enable_tp_dim", 0600, applespi->debugfs_root, > + &applespi->debug_tp_dim); > + > + debugfs_create_file("tp_dim", 0400, applespi->debugfs_root, applespi, > + &applespi_tp_dim_fops); > > return 0; > } > -- > 2.22.0 >
On Sat, Aug 10, 2019 at 12:57:34PM +0200, Greg Kroah-Hartman wrote: > When calling debugfs functions, there is no need to ever check the > return value. The function can work or not, but the code logic should > never do something different based on this. > > Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> > Cc: "Ronald Tschalär" <ronald@innovation.ch> > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > Cc: Mao Wenan <maowenan@huawei.com> > Cc: linux-input@vger.kernel.org > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Applied, thank you. > --- > drivers/input/keyboard/applespi.c | 30 ++++++------------------------ > 1 file changed, 6 insertions(+), 24 deletions(-) > > diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c > index 548737e7aeda..c822a5d2a85d 100644 > --- a/drivers/input/keyboard/applespi.c > +++ b/drivers/input/keyboard/applespi.c > @@ -1794,30 +1794,12 @@ static int applespi_probe(struct spi_device *spi) > > /* set up debugfs entries for touchpad dimensions logging */ > applespi->debugfs_root = debugfs_create_dir("applespi", NULL); > - if (IS_ERR(applespi->debugfs_root)) { > - if (PTR_ERR(applespi->debugfs_root) != -ENODEV) > - dev_warn(&applespi->spi->dev, > - "Error creating debugfs root entry (%ld)\n", > - PTR_ERR(applespi->debugfs_root)); > - } else { > - struct dentry *ret; > - > - ret = debugfs_create_bool("enable_tp_dim", 0600, > - applespi->debugfs_root, > - &applespi->debug_tp_dim); > - if (IS_ERR(ret)) > - dev_dbg(&applespi->spi->dev, > - "Error creating debugfs entry enable_tp_dim (%ld)\n", > - PTR_ERR(ret)); > - > - ret = debugfs_create_file("tp_dim", 0400, > - applespi->debugfs_root, applespi, > - &applespi_tp_dim_fops); > - if (IS_ERR(ret)) > - dev_dbg(&applespi->spi->dev, > - "Error creating debugfs entry tp_dim (%ld)\n", > - PTR_ERR(ret)); > - } > + > + debugfs_create_bool("enable_tp_dim", 0600, applespi->debugfs_root, > + &applespi->debug_tp_dim); > + > + debugfs_create_file("tp_dim", 0400, applespi->debugfs_root, applespi, > + &applespi_tp_dim_fops); > > return 0; > } > -- > 2.22.0 >
diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index 548737e7aeda..c822a5d2a85d 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -1794,30 +1794,12 @@ static int applespi_probe(struct spi_device *spi) /* set up debugfs entries for touchpad dimensions logging */ applespi->debugfs_root = debugfs_create_dir("applespi", NULL); - if (IS_ERR(applespi->debugfs_root)) { - if (PTR_ERR(applespi->debugfs_root) != -ENODEV) - dev_warn(&applespi->spi->dev, - "Error creating debugfs root entry (%ld)\n", - PTR_ERR(applespi->debugfs_root)); - } else { - struct dentry *ret; - - ret = debugfs_create_bool("enable_tp_dim", 0600, - applespi->debugfs_root, - &applespi->debug_tp_dim); - if (IS_ERR(ret)) - dev_dbg(&applespi->spi->dev, - "Error creating debugfs entry enable_tp_dim (%ld)\n", - PTR_ERR(ret)); - - ret = debugfs_create_file("tp_dim", 0400, - applespi->debugfs_root, applespi, - &applespi_tp_dim_fops); - if (IS_ERR(ret)) - dev_dbg(&applespi->spi->dev, - "Error creating debugfs entry tp_dim (%ld)\n", - PTR_ERR(ret)); - } + + debugfs_create_bool("enable_tp_dim", 0600, applespi->debugfs_root, + &applespi->debug_tp_dim); + + debugfs_create_file("tp_dim", 0400, applespi->debugfs_root, applespi, + &applespi_tp_dim_fops); return 0; }
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: "Ronald Tschalär" <ronald@innovation.ch> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: Mao Wenan <maowenan@huawei.com> Cc: linux-input@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/input/keyboard/applespi.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-)