* [PATCH] watchdog: bcm_kona_wdt: no need to check return value of debugfs_create functions
@ 2019-06-18 15:58 Greg Kroah-Hartman
2019-06-18 17:05 ` Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2019-06-18 15:58 UTC (permalink / raw)
To: Wim Van Sebroeck, Guenter Roeck, Florian Fainelli, Ray Jui,
Scott Branden
Cc: bcm-kernel-feedback-list, linux-watchdog
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: Wim Van Sebroeck <wim@linux-watchdog.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: linux-watchdog@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/watchdog/bcm_kona_wdt.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c
index e2ad44816359..921291025680 100644
--- a/drivers/watchdog/bcm_kona_wdt.c
+++ b/drivers/watchdog/bcm_kona_wdt.c
@@ -143,24 +143,18 @@ static void bcm_kona_wdt_debug_init(struct platform_device *pdev)
wdt->debugfs = NULL;
dir = debugfs_create_dir(BCM_KONA_WDT_NAME, NULL);
- if (IS_ERR_OR_NULL(dir))
- return;
- if (debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt,
- &bcm_kona_fops))
- wdt->debugfs = dir;
- else
- debugfs_remove_recursive(dir);
+ debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt,
+ &bcm_kona_fops);
+ wdt->debugfs = dir;
}
static void bcm_kona_wdt_debug_exit(struct platform_device *pdev)
{
struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev);
- if (wdt && wdt->debugfs) {
+ if (wdt)
debugfs_remove_recursive(wdt->debugfs);
- wdt->debugfs = NULL;
- }
}
#else
--
2.22.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] watchdog: bcm_kona_wdt: no need to check return value of debugfs_create functions
2019-06-18 15:58 [PATCH] watchdog: bcm_kona_wdt: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2019-06-18 17:05 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-06-18 17:05 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Wim Van Sebroeck, Florian Fainelli, Ray Jui, Scott Branden,
bcm-kernel-feedback-list, linux-watchdog
On Tue, Jun 18, 2019 at 05:58:09PM +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: Wim Van Sebroeck <wim@linux-watchdog.org>
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Ray Jui <rjui@broadcom.com>
> Cc: Scott Branden <sbranden@broadcom.com>
> Cc: bcm-kernel-feedback-list@broadcom.com
> Cc: linux-watchdog@vger.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/bcm_kona_wdt.c | 14 ++++----------
> 1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/watchdog/bcm_kona_wdt.c b/drivers/watchdog/bcm_kona_wdt.c
> index e2ad44816359..921291025680 100644
> --- a/drivers/watchdog/bcm_kona_wdt.c
> +++ b/drivers/watchdog/bcm_kona_wdt.c
> @@ -143,24 +143,18 @@ static void bcm_kona_wdt_debug_init(struct platform_device *pdev)
> wdt->debugfs = NULL;
>
> dir = debugfs_create_dir(BCM_KONA_WDT_NAME, NULL);
> - if (IS_ERR_OR_NULL(dir))
> - return;
>
> - if (debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt,
> - &bcm_kona_fops))
> - wdt->debugfs = dir;
> - else
> - debugfs_remove_recursive(dir);
> + debugfs_create_file("info", S_IFREG | S_IRUGO, dir, wdt,
> + &bcm_kona_fops);
> + wdt->debugfs = dir;
> }
>
> static void bcm_kona_wdt_debug_exit(struct platform_device *pdev)
> {
> struct bcm_kona_wdt *wdt = platform_get_drvdata(pdev);
>
> - if (wdt && wdt->debugfs) {
> + if (wdt)
> debugfs_remove_recursive(wdt->debugfs);
> - wdt->debugfs = NULL;
> - }
> }
>
> #else
> --
> 2.22.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-18 17:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-18 15:58 [PATCH] watchdog: bcm_kona_wdt: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2019-06-18 17:05 ` Guenter Roeck
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.