diff mbox series

[2/3] gpio: tegra: no need to cast away return value of debugfs_create_file()

Message ID 20190618155047.16894-2-gregkh@linuxfoundation.org
State New
Headers show
Series [1/3] gpiolib: no need to cast away return value of debugfs_create_file() | expand

Commit Message

Greg Kroah-Hartman June 18, 2019, 3:50 p.m. UTC
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(-)

Comments

Jon Hunter June 18, 2019, 4:26 p.m. UTC | #1
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
Greg Kroah-Hartman June 18, 2019, 5:17 p.m. UTC | #2
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
Jon Hunter June 18, 2019, 5:49 p.m. UTC | #3
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
Greg Kroah-Hartman June 18, 2019, 6:05 p.m. UTC | #4
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
Thierry Reding June 19, 2019, 8:19 a.m. UTC | #5
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>
Linus Walleij June 25, 2019, 12:45 p.m. UTC | #6
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
diff mbox series

Patch

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