power: charger-manager: clarify num_properties starting value

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>
This commit is contained in:
Michał Mirosław 2020-05-01 16:30:43 +02:00 committed by Sebastian Reichel
parent b0e4aa97ea
commit 97ed79f493

View File

@ -1729,7 +1729,7 @@ static int charger_manager_probe(struct platform_device *pdev)
memcpy(properties, default_charger_props, memcpy(properties, default_charger_props,
sizeof(enum power_supply_property) * sizeof(enum power_supply_property) *
ARRAY_SIZE(default_charger_props)); 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 */ /* Find which optional psy-properties are available */
fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge); fuel_gauge = power_supply_get_by_name(desc->psy_fuel_gauge);