diff mbox series

HID: playstation: fix unused variable in ps_battery_get_property.

Message ID 20210212064100.27193-1-roderick@gaikai.com (mailing list archive)
State Mainlined
Commit 5fb52551248f54ddc8f72bc252661468b603cfcc
Delegated to: Jiri Kosina
Headers show
Series HID: playstation: fix unused variable in ps_battery_get_property. | expand

Commit Message

Roderick Colenbrander Feb. 12, 2021, 6:41 a.m. UTC
From: Roderick Colenbrander <roderick.colenbrander@sony.com>

The ret variable in ps_battery_get_property is set in an error path,
but never actually returned. Change the function to return ret.

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
---
 drivers/hid/hid-playstation.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Benjamin Tissoires Feb. 12, 2021, 9:06 a.m. UTC | #1
On Fri, Feb 12, 2021 at 7:41 AM Roderick Colenbrander
<roderick@gaikai.com> wrote:
>
> From: Roderick Colenbrander <roderick.colenbrander@sony.com>
>
> The ret variable in ps_battery_get_property is set in an error path,
> but never actually returned. Change the function to return ret.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Roderick Colenbrander <roderick.colenbrander@sony.com>
> ---

Applied, thanks for the quick fix.

Cheers,
Benjamin

>  drivers/hid/hid-playstation.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
> index cc93c16cc822..408b651174cf 100644
> --- a/drivers/hid/hid-playstation.c
> +++ b/drivers/hid/hid-playstation.c
> @@ -391,7 +391,7 @@ static int ps_battery_get_property(struct power_supply *psy,
>         uint8_t battery_capacity;
>         int battery_status;
>         unsigned long flags;
> -       int ret;
> +       int ret = 0;
>
>         spin_lock_irqsave(&dev->lock, flags);
>         battery_capacity = dev->battery_capacity;
> @@ -416,7 +416,7 @@ static int ps_battery_get_property(struct power_supply *psy,
>                 break;
>         }
>
> -       return 0;
> +       return ret;
>  }
>
>  static int ps_device_register_battery(struct ps_device *dev)
> --
> 2.26.2
>
diff mbox series

Patch

diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index cc93c16cc822..408b651174cf 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -391,7 +391,7 @@  static int ps_battery_get_property(struct power_supply *psy,
 	uint8_t battery_capacity;
 	int battery_status;
 	unsigned long flags;
-	int ret;
+	int ret = 0;
 
 	spin_lock_irqsave(&dev->lock, flags);
 	battery_capacity = dev->battery_capacity;
@@ -416,7 +416,7 @@  static int ps_battery_get_property(struct power_supply *psy,
 		break;
 	}
 
-	return 0;
+	return ret;
 }
 
 static int ps_device_register_battery(struct ps_device *dev)