]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
HID: playstation: fix unused variable in ps_battery_get_property.
authorRoderick Colenbrander <roderick.colenbrander@sony.com>
Fri, 12 Feb 2021 06:41:00 +0000 (22:41 -0800)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Fri, 12 Feb 2021 07:57:06 +0000 (08:57 +0100)
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>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
drivers/hid/hid-playstation.c

index cc93c16cc82222c27afa66f3cf559250dd6af137..408b651174cf44389c7a60c06ede5a60a1499cf6 100644 (file)
@@ -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)