power: charger-manager: clarify num_properties starting value
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Fri, 1 May 2020 14:30:43 +0000 (16:30 +0200)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Fri, 1 May 2020 14:48:02 +0000 (16:48 +0200)
Initialize num_properties with length of the copied array instead
of relying on previously memcpy'd value. This makes it clear how
the array and the counter are related.

Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/charger-manager.c

index 415a9efa681614cce7df069c4a2d77ec5365aeb5..2ef53dc1f2fb7584320f9583f4abd0b281ebfa69 100644 (file)
@@ -1729,7 +1729,7 @@ static int charger_manager_probe(struct platform_device *pdev)
        memcpy(properties, default_charger_props,
                sizeof(enum power_supply_property) *
                ARRAY_SIZE(default_charger_props));
-       num_properties = psy_default.num_properties;
+       num_properties = ARRAY_SIZE(default_charger_props);
 
        /* Find which optional psy-properties are available */
        fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge);