* [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file()
@ 2019-06-18 15:50 Greg Kroah-Hartman
2019-06-18 15:50 ` [PATCH 2/3] gpio: tegra: " Greg Kroah-Hartman
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-18 15:50 UTC (permalink / raw)
To: bamv2005, linus.walleij, bgolaszewski; +Cc: Greg Kroah-Hartman, linux-gpio
It is fine to ignore the return value (and encouraged), so need to cast
away the return value, you will not get a build warning at all.
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpiolib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index e013d417a936..d378774d3456 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -4805,8 +4805,8 @@ static const struct file_operations gpiolib_operations = {
static int __init gpiolib_debugfs_init(void)
{
/* /sys/kernel/debug/gpio */
- (void) debugfs_create_file("gpio", S_IFREG | S_IRUGO,
- NULL, NULL, &gpiolib_operations);
+ debugfs_create_file("gpio", S_IFREG | S_IRUGO, NULL, NULL,
+ &gpiolib_operations);
return 0;
}
subsys_initcall(gpiolib_debugfs_init);
--
2.22.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 2/3] gpio: tegra: no need to cast away return value of debugfs_create_file()
2019-06-18 15:50 [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file() Greg Kroah-Hartman
@ 2019-06-18 15:50 ` Greg Kroah-Hartman
2019-06-18 16:26 ` Jon Hunter
` (2 more replies)
2019-06-18 15:50 ` [PATCH 3/3] gpio: mockup: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-25 12:29 ` [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file() Linus Walleij
2 siblings, 3 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-18 15:50 UTC (permalink / raw)
To: bamv2005, linus.walleij, bgolaszewski
Cc: Greg Kroah-Hartman, Thierry Reding, Jonathan Hunter, linux-gpio,
linux-tegra
It is fine to ignore the return value (and encouraged), so need to cast
away the return value, you will not get a build warning at all.
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Jonathan Hunter <jonathanh@nvidia.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-tegra.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
index 6d9b6906b9d0..a54bba1bda6c 100644
--- a/drivers/gpio/gpio-tegra.c
+++ b/drivers/gpio/gpio-tegra.c
@@ -550,8 +550,8 @@ DEFINE_SHOW_ATTRIBUTE(tegra_dbg_gpio);
static void tegra_gpio_debuginit(struct tegra_gpio_info *tgi)
{
- (void) debugfs_create_file("tegra_gpio", 0444,
- NULL, tgi, &tegra_dbg_gpio_fops);
+ debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
+ &tegra_dbg_gpio_fops);
}
#else
--
2.22.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 3/3] gpio: mockup: no need to check return value of debugfs_create functions
2019-06-18 15:50 [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file() Greg Kroah-Hartman
2019-06-18 15:50 ` [PATCH 2/3] gpio: tegra: " Greg Kroah-Hartman
@ 2019-06-18 15:50 ` Greg Kroah-Hartman
2019-06-20 7:25 ` [PATCH v2] " Greg Kroah-Hartman
2019-06-25 12:29 ` [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file() Linus Walleij
2 siblings, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-18 15:50 UTC (permalink / raw)
To: bamv2005, linus.walleij, bgolaszewski; +Cc: Greg Kroah-Hartman, linux-gpio
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: Bamvor Jian Zhang <bamv2005@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/gpio/gpio-mockup.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index b6a4efce7c92..f955aff6dd82 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -325,8 +325,6 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
devname = dev_name(&gc->gpiodev->dev);
chip->dbg_dir = debugfs_create_dir(devname, gpio_mockup_dbg_dir);
- if (IS_ERR_OR_NULL(chip->dbg_dir))
- goto err;
for (i = 0; i < gc->ngpio; i++) {
name = devm_kasprintf(dev, GFP_KERNEL, "%d", i);
@@ -341,16 +339,11 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
priv->offset = i;
priv->desc = &gc->gpiodev->descs[i];
- evfile = debugfs_create_file(name, 0200, chip->dbg_dir, priv,
- &gpio_mockup_debugfs_ops);
- if (IS_ERR_OR_NULL(evfile))
- goto err;
+ debugfs_create_file(name, 0200, chip->dbg_dir, priv,
+ &gpio_mockup_debugfs_ops);
}
return;
-
-err:
- dev_err(dev, "error creating debugfs files\n");
}
static int gpio_mockup_name_lines(struct device *dev,
@@ -501,8 +494,6 @@ static int __init gpio_mockup_init(void)
}
gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup", NULL);
- if (IS_ERR_OR_NULL(gpio_mockup_dbg_dir))
- gpio_mockup_err("error creating debugfs directory\n");
err = platform_driver_register(&gpio_mockup_driver);
if (err) {
--
2.22.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] gpio: tegra: no need to cast away return value of debugfs_create_file()
2019-06-18 15:50 ` [PATCH 2/3] gpio: tegra: " Greg Kroah-Hartman
@ 2019-06-18 16:26 ` Jon Hunter
2019-06-18 17:17 ` Greg Kroah-Hartman
2019-06-19 8:19 ` Thierry Reding
2019-06-25 12:45 ` Linus Walleij
2 siblings, 1 reply; 12+ messages in thread
From: Jon Hunter @ 2019-06-18 16:26 UTC (permalink / raw)
To: Greg Kroah-Hartman, bamv2005, linus.walleij, bgolaszewski
Cc: Thierry Reding, linux-gpio, linux-tegra
On 18/06/2019 16:50, Greg Kroah-Hartman wrote:
> It is fine to ignore the return value (and encouraged), so need to cast
I assume you mean 'no need' here.
> away the return value, you will not get a build warning at all.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Jonathan Hunter <jonathanh@nvidia.com>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-tegra@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/gpio/gpio-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> index 6d9b6906b9d0..a54bba1bda6c 100644
> --- a/drivers/gpio/gpio-tegra.c
> +++ b/drivers/gpio/gpio-tegra.c
> @@ -550,8 +550,8 @@ DEFINE_SHOW_ATTRIBUTE(tegra_dbg_gpio);
>
> static void tegra_gpio_debuginit(struct tegra_gpio_info *tgi)
> {
> - (void) debugfs_create_file("tegra_gpio", 0444,
> - NULL, tgi, &tegra_dbg_gpio_fops);
> + debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
> + &tegra_dbg_gpio_fops);
> }
>
> #else
Looks like we can get rid of this entire function and just call
debugfs_create_file directly to simplify the code even more. We can
handle that.
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Thanks
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] gpio: tegra: no need to cast away return value of debugfs_create_file()
2019-06-18 16:26 ` Jon Hunter
@ 2019-06-18 17:17 ` Greg Kroah-Hartman
2019-06-18 17:49 ` Jon Hunter
0 siblings, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-18 17:17 UTC (permalink / raw)
To: Jon Hunter
Cc: bamv2005, linus.walleij, bgolaszewski, Thierry Reding, linux-gpio,
linux-tegra
On Tue, Jun 18, 2019 at 05:26:28PM +0100, Jon Hunter wrote:
>
> On 18/06/2019 16:50, Greg Kroah-Hartman wrote:
> > It is fine to ignore the return value (and encouraged), so need to cast
>
> I assume you mean 'no need' here.
{sigh} yes :)
> > away the return value, you will not get a build warning at all.
> >
> > Cc: Linus Walleij <linus.walleij@linaro.org>
> > Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> > Cc: Thierry Reding <thierry.reding@gmail.com>
> > Cc: Jonathan Hunter <jonathanh@nvidia.com>
> > Cc: linux-gpio@vger.kernel.org
> > Cc: linux-tegra@vger.kernel.org
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> > drivers/gpio/gpio-tegra.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> > index 6d9b6906b9d0..a54bba1bda6c 100644
> > --- a/drivers/gpio/gpio-tegra.c
> > +++ b/drivers/gpio/gpio-tegra.c
> > @@ -550,8 +550,8 @@ DEFINE_SHOW_ATTRIBUTE(tegra_dbg_gpio);
> >
> > static void tegra_gpio_debuginit(struct tegra_gpio_info *tgi)
> > {
> > - (void) debugfs_create_file("tegra_gpio", 0444,
> > - NULL, tgi, &tegra_dbg_gpio_fops);
> > + debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
> > + &tegra_dbg_gpio_fops);
> > }
> >
> > #else
>
> Looks like we can get rid of this entire function and just call
> debugfs_create_file directly to simplify the code even more. We can
> handle that.
>
> Acked-by: Jon Hunter <jonathanh@nvidia.com>
Great! Do you want to just take this through your tree and then add
that change on top of it? Or do you need me to take it and make that
change?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] gpio: tegra: no need to cast away return value of debugfs_create_file()
2019-06-18 17:17 ` Greg Kroah-Hartman
@ 2019-06-18 17:49 ` Jon Hunter
2019-06-18 18:05 ` Greg Kroah-Hartman
0 siblings, 1 reply; 12+ messages in thread
From: Jon Hunter @ 2019-06-18 17:49 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: bamv2005, linus.walleij, bgolaszewski, Thierry Reding, linux-gpio,
linux-tegra
On 18/06/2019 18:17, Greg Kroah-Hartman wrote:
> On Tue, Jun 18, 2019 at 05:26:28PM +0100, Jon Hunter wrote:
>>
>> On 18/06/2019 16:50, Greg Kroah-Hartman wrote:
>>> It is fine to ignore the return value (and encouraged), so need to cast
>>
>> I assume you mean 'no need' here.
>
> {sigh} yes :)
>
>>> away the return value, you will not get a build warning at all.
>>>
>>> Cc: Linus Walleij <linus.walleij@linaro.org>
>>> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>> Cc: Thierry Reding <thierry.reding@gmail.com>
>>> Cc: Jonathan Hunter <jonathanh@nvidia.com>
>>> Cc: linux-gpio@vger.kernel.org
>>> Cc: linux-tegra@vger.kernel.org
>>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>> ---
>>> drivers/gpio/gpio-tegra.c | 4 ++--
>>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
>>> index 6d9b6906b9d0..a54bba1bda6c 100644
>>> --- a/drivers/gpio/gpio-tegra.c
>>> +++ b/drivers/gpio/gpio-tegra.c
>>> @@ -550,8 +550,8 @@ DEFINE_SHOW_ATTRIBUTE(tegra_dbg_gpio);
>>>
>>> static void tegra_gpio_debuginit(struct tegra_gpio_info *tgi)
>>> {
>>> - (void) debugfs_create_file("tegra_gpio", 0444,
>>> - NULL, tgi, &tegra_dbg_gpio_fops);
>>> + debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
>>> + &tegra_dbg_gpio_fops);
>>> }
>>>
>>> #else
>>
>> Looks like we can get rid of this entire function and just call
>> debugfs_create_file directly to simplify the code even more. We can
>> handle that.
>>
>> Acked-by: Jon Hunter <jonathanh@nvidia.com>
>
> Great! Do you want to just take this through your tree and then add
> that change on top of it? Or do you need me to take it and make that
> change?
No its fine, we can fix this.
Cheers
Jon
--
nvpublic
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] gpio: tegra: no need to cast away return value of debugfs_create_file()
2019-06-18 17:49 ` Jon Hunter
@ 2019-06-18 18:05 ` Greg Kroah-Hartman
0 siblings, 0 replies; 12+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-18 18:05 UTC (permalink / raw)
To: Jon Hunter
Cc: bamv2005, linus.walleij, bgolaszewski, Thierry Reding, linux-gpio,
linux-tegra
On Tue, Jun 18, 2019 at 06:49:23PM +0100, Jon Hunter wrote:
>
> On 18/06/2019 18:17, Greg Kroah-Hartman wrote:
> > On Tue, Jun 18, 2019 at 05:26:28PM +0100, Jon Hunter wrote:
> >>
> >> On 18/06/2019 16:50, Greg Kroah-Hartman wrote:
> >>> It is fine to ignore the return value (and encouraged), so need to cast
> >>
> >> I assume you mean 'no need' here.
> >
> > {sigh} yes :)
> >
> >>> away the return value, you will not get a build warning at all.
> >>>
> >>> Cc: Linus Walleij <linus.walleij@linaro.org>
> >>> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >>> Cc: Thierry Reding <thierry.reding@gmail.com>
> >>> Cc: Jonathan Hunter <jonathanh@nvidia.com>
> >>> Cc: linux-gpio@vger.kernel.org
> >>> Cc: linux-tegra@vger.kernel.org
> >>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >>> ---
> >>> drivers/gpio/gpio-tegra.c | 4 ++--
> >>> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c
> >>> index 6d9b6906b9d0..a54bba1bda6c 100644
> >>> --- a/drivers/gpio/gpio-tegra.c
> >>> +++ b/drivers/gpio/gpio-tegra.c
> >>> @@ -550,8 +550,8 @@ DEFINE_SHOW_ATTRIBUTE(tegra_dbg_gpio);
> >>>
> >>> static void tegra_gpio_debuginit(struct tegra_gpio_info *tgi)
> >>> {
> >>> - (void) debugfs_create_file("tegra_gpio", 0444,
> >>> - NULL, tgi, &tegra_dbg_gpio_fops);
> >>> + debugfs_create_file("tegra_gpio", 0444, NULL, tgi,
> >>> + &tegra_dbg_gpio_fops);
> >>> }
> >>>
> >>> #else
> >>
> >> Looks like we can get rid of this entire function and just call
> >> debugfs_create_file directly to simplify the code even more. We can
> >> handle that.
> >>
> >> Acked-by: Jon Hunter <jonathanh@nvidia.com>
> >
> > Great! Do you want to just take this through your tree and then add
> > that change on top of it? Or do you need me to take it and make that
> > change?
>
> No its fine, we can fix this.
Wonderful, thank you!
greg k-h
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] gpio: tegra: no need to cast away return value of debugfs_create_file()
2019-06-18 15:50 ` [PATCH 2/3] gpio: tegra: " Greg Kroah-Hartman
2019-06-18 16:26 ` Jon Hunter
@ 2019-06-19 8:19 ` Thierry Reding
2019-06-25 12:45 ` Linus Walleij
2 siblings, 0 replies; 12+ messages in thread
From: Thierry Reding @ 2019-06-19 8:19 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: bamv2005, linus.walleij, bgolaszewski, Jonathan Hunter,
linux-gpio, linux-tegra
[-- Attachment #1: Type: text/plain, Size: 695 bytes --]
On Tue, Jun 18, 2019 at 05:50:46PM +0200, Greg Kroah-Hartman wrote:
> It is fine to ignore the return value (and encouraged), so need to cast
> away the return value, you will not get a build warning at all.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Jonathan Hunter <jonathanh@nvidia.com>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-tegra@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> drivers/gpio/gpio-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Acked-by: Thierry Reding <treding@nvidia.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v2] gpio: mockup: no need to check return value of debugfs_create functions
2019-06-18 15:50 ` [PATCH 3/3] gpio: mockup: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-06-20 7:25 ` Greg Kroah-Hartman
2019-06-24 8:20 ` Bartosz Golaszewski
0 siblings, 1 reply; 12+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-20 7:25 UTC (permalink / raw)
To: bamv2005, linus.walleij, bgolaszewski; +Cc: linux-gpio
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: Bamvor Jian Zhang <bamv2005@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
v2: fix build warning found by kbuild
fix build error found by kbuild. Did I even build this thing
myself???
drivers/gpio/gpio-mockup.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index b6a4efce7c92..135dac099d1e 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -315,7 +315,6 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
struct gpio_mockup_chip *chip)
{
struct gpio_mockup_dbgfs_private *priv;
- struct dentry *evfile;
struct gpio_chip *gc;
const char *devname;
char *name;
@@ -325,32 +324,25 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
devname = dev_name(&gc->gpiodev->dev);
chip->dbg_dir = debugfs_create_dir(devname, gpio_mockup_dbg_dir);
- if (IS_ERR_OR_NULL(chip->dbg_dir))
- goto err;
for (i = 0; i < gc->ngpio; i++) {
name = devm_kasprintf(dev, GFP_KERNEL, "%d", i);
if (!name)
- goto err;
+ return;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
- goto err;
+ return;
priv->chip = chip;
priv->offset = i;
priv->desc = &gc->gpiodev->descs[i];
- evfile = debugfs_create_file(name, 0200, chip->dbg_dir, priv,
- &gpio_mockup_debugfs_ops);
- if (IS_ERR_OR_NULL(evfile))
- goto err;
+ debugfs_create_file(name, 0200, chip->dbg_dir, priv,
+ &gpio_mockup_debugfs_ops);
}
return;
-
-err:
- dev_err(dev, "error creating debugfs files\n");
}
static int gpio_mockup_name_lines(struct device *dev,
@@ -501,8 +493,6 @@ static int __init gpio_mockup_init(void)
}
gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup", NULL);
- if (IS_ERR_OR_NULL(gpio_mockup_dbg_dir))
- gpio_mockup_err("error creating debugfs directory\n");
err = platform_driver_register(&gpio_mockup_driver);
if (err) {
--
2.22.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v2] gpio: mockup: no need to check return value of debugfs_create functions
2019-06-20 7:25 ` [PATCH v2] " Greg Kroah-Hartman
@ 2019-06-24 8:20 ` Bartosz Golaszewski
0 siblings, 0 replies; 12+ messages in thread
From: Bartosz Golaszewski @ 2019-06-24 8:20 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: bamv2005, Linus Walleij, linux-gpio
czw., 20 cze 2019 o 09:25 Greg Kroah-Hartman
<gregkh@linuxfoundation.org> napisał(a):
>
> 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: Bamvor Jian Zhang <bamv2005@gmail.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> v2: fix build warning found by kbuild
> fix build error found by kbuild. Did I even build this thing
> myself???
>
> drivers/gpio/gpio-mockup.c | 18 ++++--------------
> 1 file changed, 4 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index b6a4efce7c92..135dac099d1e 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -315,7 +315,6 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
> struct gpio_mockup_chip *chip)
> {
> struct gpio_mockup_dbgfs_private *priv;
> - struct dentry *evfile;
> struct gpio_chip *gc;
> const char *devname;
> char *name;
> @@ -325,32 +324,25 @@ static void gpio_mockup_debugfs_setup(struct device *dev,
> devname = dev_name(&gc->gpiodev->dev);
>
> chip->dbg_dir = debugfs_create_dir(devname, gpio_mockup_dbg_dir);
> - if (IS_ERR_OR_NULL(chip->dbg_dir))
> - goto err;
>
> for (i = 0; i < gc->ngpio; i++) {
> name = devm_kasprintf(dev, GFP_KERNEL, "%d", i);
> if (!name)
> - goto err;
> + return;
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> - goto err;
> + return;
>
> priv->chip = chip;
> priv->offset = i;
> priv->desc = &gc->gpiodev->descs[i];
>
> - evfile = debugfs_create_file(name, 0200, chip->dbg_dir, priv,
> - &gpio_mockup_debugfs_ops);
> - if (IS_ERR_OR_NULL(evfile))
> - goto err;
> + debugfs_create_file(name, 0200, chip->dbg_dir, priv,
> + &gpio_mockup_debugfs_ops);
> }
>
> return;
> -
> -err:
> - dev_err(dev, "error creating debugfs files\n");
> }
>
> static int gpio_mockup_name_lines(struct device *dev,
> @@ -501,8 +493,6 @@ static int __init gpio_mockup_init(void)
> }
>
> gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup", NULL);
> - if (IS_ERR_OR_NULL(gpio_mockup_dbg_dir))
> - gpio_mockup_err("error creating debugfs directory\n");
>
> err = platform_driver_register(&gpio_mockup_driver);
> if (err) {
> --
> 2.22.0
>
Shouldn't this patch also make the driver unconditionally call
gpio_mockup_debugfs_setup() at line 450?
Bart
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file()
2019-06-18 15:50 [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file() Greg Kroah-Hartman
2019-06-18 15:50 ` [PATCH 2/3] gpio: tegra: " Greg Kroah-Hartman
2019-06-18 15:50 ` [PATCH 3/3] gpio: mockup: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-06-25 12:29 ` Linus Walleij
2 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2019-06-25 12:29 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Bamvor Jian Zhang, Bartosz Golaszewski, open list:GPIO SUBSYSTEM
On Tue, Jun 18, 2019 at 5:50 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> It is fine to ignore the return value (and encouraged), so need to cast
> away the return value, you will not get a build warning at all.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: linux-gpio@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 2/3] gpio: tegra: no need to cast away return value of debugfs_create_file()
2019-06-18 15:50 ` [PATCH 2/3] gpio: tegra: " Greg Kroah-Hartman
2019-06-18 16:26 ` Jon Hunter
2019-06-19 8:19 ` Thierry Reding
@ 2019-06-25 12:45 ` Linus Walleij
2 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2019-06-25 12:45 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Bamvor Jian Zhang, Bartosz Golaszewski, Thierry Reding,
Jonathan Hunter, open list:GPIO SUBSYSTEM, linux-tegra
On Tue, Jun 18, 2019 at 5:51 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> It is fine to ignore the return value (and encouraged), so need to cast
> away the return value, you will not get a build warning at all.
>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> Cc: Thierry Reding <thierry.reding@gmail.com>
> Cc: Jonathan Hunter <jonathanh@nvidia.com>
> Cc: linux-gpio@vger.kernel.org
> Cc: linux-tegra@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Patch applied, fixing wording and stacking up the ACKs.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2019-06-25 12:45 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-18 15:50 [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file() Greg Kroah-Hartman
2019-06-18 15:50 ` [PATCH 2/3] gpio: tegra: " Greg Kroah-Hartman
2019-06-18 16:26 ` Jon Hunter
2019-06-18 17:17 ` Greg Kroah-Hartman
2019-06-18 17:49 ` Jon Hunter
2019-06-18 18:05 ` Greg Kroah-Hartman
2019-06-19 8:19 ` Thierry Reding
2019-06-25 12:45 ` Linus Walleij
2019-06-18 15:50 ` [PATCH 3/3] gpio: mockup: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-20 7:25 ` [PATCH v2] " Greg Kroah-Hartman
2019-06-24 8:20 ` Bartosz Golaszewski
2019-06-25 12:29 ` [PATCH 1/3] gpiolib: no need to cast away return value of debugfs_create_file() Linus Walleij
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).