From: Rui Miguel Silva Date: Fri, 8 Jan 2016 13:53:46 +0000 (+0000) Subject: greybus: power_supply: fix leak getting string properties X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f921fb139bd5ee008ec993c76b8a89a535fd11e9;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git greybus: power_supply: fix leak getting string properties When fetching string properties, memory was being allocated and leaked when it was not necessary to do so. Signed-off-by: Rui Miguel Silva Reviewed-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index 28548a243240..3c9bb12351e4 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -347,15 +347,13 @@ static int __gb_power_supply_property_strval_get(struct gb_power_supply *gbpsy, { switch (psp) { case POWER_SUPPLY_PROP_MODEL_NAME: - val->strval = kstrndup(gbpsy->model_name, PROP_MAX, GFP_KERNEL); + val->strval = gbpsy->model_name; break; case POWER_SUPPLY_PROP_MANUFACTURER: - val->strval = kstrndup(gbpsy->manufacturer, PROP_MAX, - GFP_KERNEL); + val->strval = gbpsy->manufacturer; break; case POWER_SUPPLY_PROP_SERIAL_NUMBER: - val->strval = kstrndup(gbpsy->serial_number, PROP_MAX, - GFP_KERNEL); + val->strval = gbpsy->serial_number; break; default: break;