Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751159AbdIWHz7 (ORCPT ); Sat, 23 Sep 2017 03:55:59 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34951 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750766AbdIWHz6 (ORCPT ); Sat, 23 Sep 2017 03:55:58 -0400 X-Google-Smtp-Source: AOwi7QAM9Ug7iywv0RXe6kmUeKBjp5PIZ1FtV4pyyDhhKhehXxHe1q8nvruzxNSsfMVONe4dV/jTVg== From: Arvind Yadav To: rmfrfs@gmail.com, johan@kernel.org, elder@kernel.org, gregkh@linuxfoundation.org Cc: greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] staging: greybus: light: Release memory obtained by kasprintf Date: Sat, 23 Sep 2017 13:25:30 +0530 Message-Id: X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 922 Lines: 31 Free memory region, if gb_lights_channel_config is not successful. Signed-off-by: Arvind Yadav --- changes in v2: - Subject line changed. - add kfree in __gb_lights_led_unregister(). - No need to check return value of gb_lights_channel_flash_config(). changes ib v3: - separate patch for "No need to check return value of gb_lights_channel_flash_config()". drivers/staging/greybus/light.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index 3f4148c..0f538b8 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -925,6 +925,8 @@ static void __gb_lights_led_unregister(struct gb_channel *channel) return; led_classdev_unregister(cdev); + kfree(cdev->name); + cdev->name = NULL; channel->led = NULL; } -- 2.7.4