diff mbox series

watchdog_core: Remove unnecessary ‘0’ values from ret

Message ID 20231021105748.18280-1-fenghui@nfschina.com (mailing list archive)
State New
Headers show
Series watchdog_core: Remove unnecessary ‘0’ values from ret | expand

Commit Message

fenghui Oct. 21, 2023, 10:57 a.m. UTC
ret is assigned first, so it does not need to initialize the assignment.

Signed-off-by: fenghui <fenghui@nfschina.com>
---
 drivers/watchdog/watchdog_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Guenter Roeck Oct. 23, 2023, 12:11 a.m. UTC | #1
On 10/21/23 03:57, fenghui wrote:
> ret is assigned first, so it does not need to initialize the assignment.
> 
> Signed-off-by: fenghui <fenghui@nfschina.com>
> ---
>   drivers/watchdog/watchdog_core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
> index 5b55ccae06d4..dceaf5cc89fd 100644
> --- a/drivers/watchdog/watchdog_core.c
> +++ b/drivers/watchdog/watchdog_core.c
> @@ -194,7 +194,7 @@ static int watchdog_pm_notifier(struct notifier_block *nb, unsigned long mode,
>   				void *data)
>   {
>   	struct watchdog_device *wdd;
> -	int ret = 0;
> +	int ret;
>   
>   	wdd = container_of(nb, struct watchdog_device, pm_nb);
>   

NACK

Complete code:

static int watchdog_pm_notifier(struct notifier_block *nb, unsigned long mode,
                                 void *data)
{
         struct watchdog_device *wdd;
         int ret = 0;

         wdd = container_of(nb, struct watchdog_device, pm_nb);

         switch (mode) {
         case PM_HIBERNATION_PREPARE:
         case PM_RESTORE_PREPARE:
         case PM_SUSPEND_PREPARE:
                 ret = watchdog_dev_suspend(wdd);
                 break;
         case PM_POST_HIBERNATION:
         case PM_POST_RESTORE:
         case PM_POST_SUSPEND:
                 ret = watchdog_dev_resume(wdd);
                 break;
         }

         if (ret)
                 return NOTIFY_BAD;

         return NOTIFY_DONE;
}

ret is not set in the default: case.

I don't know what this is about; you have submitted two patches
in a row, both of which would introduce a problem if accepted.
Is this a test ? Either case, please refrain from submitting
such patches in the future.

Guenter
diff mbox series

Patch

diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 5b55ccae06d4..dceaf5cc89fd 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -194,7 +194,7 @@  static int watchdog_pm_notifier(struct notifier_block *nb, unsigned long mode,
 				void *data)
 {
 	struct watchdog_device *wdd;
-	int ret = 0;
+	int ret;
 
 	wdd = container_of(nb, struct watchdog_device, pm_nb);