Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1737187 > unrolled thread

[PATCH v2] staging: greybus: light: Release memory obtained by kasprintf

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-09-22 07:30 +0200
Last post2017-09-22 22:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2] staging: greybus: light: Release memory obtained by kasprintf Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-09-22 07:30 +0200
    Re: [PATCH v2] staging: greybus: light: Release memory obtained by  kasprintf Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-22 22:30 +0200

#1737187 — [PATCH v2] staging: greybus: light: Release memory obtained by kasprintf

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-09-22 07:30 +0200
Subject[PATCH v2] staging: greybus: light: Release memory obtained by kasprintf
Message-ID<usoHf-2cl-1@gated-at.bofh.it>
 - Free memory region, if gb_lights_channel_config is not successful.
 - No need to add check for gb_lights_channel_flash_config().

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
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().

 drivers/staging/greybus/light.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
index 3f4148c..bc1f8d2 100644
--- a/drivers/staging/greybus/light.c
+++ b/drivers/staging/greybus/light.c
@@ -926,6 +926,8 @@ static void __gb_lights_led_unregister(struct gb_channel *channel)
 
 	led_classdev_unregister(cdev);
 	channel->led = NULL;
+	kfree(cdev->name);
+	cdev->name = NULL;
 }
 
 static void gb_lights_channel_unregister(struct gb_channel *channel)
@@ -998,11 +1000,8 @@ static int gb_lights_channel_config(struct gb_light *light,
 
 	light->has_flash = true;
 
-	ret = gb_lights_channel_flash_config(channel);
-	if (ret < 0)
-		return ret;
+	return gb_lights_channel_flash_config(channel);
 
-	return ret;
 }
 
 static int gb_lights_light_config(struct gb_lights *glights, u8 id)
-- 
1.9.1

[toc] | [next] | [standalone]


#1737842 — Re: [PATCH v2] staging: greybus: light: Release memory obtained by kasprintf

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-09-22 22:30 +0200
SubjectRe: [PATCH v2] staging: greybus: light: Release memory obtained by kasprintf
Message-ID<usCKd-28l-1@gated-at.bofh.it>
In reply to#1737187
On Fri, Sep 22, 2017 at 10:49:43AM +0530, Arvind Yadav wrote:
>  - Free memory region, if gb_lights_channel_config is not successful.
>  - No need to add check for gb_lights_channel_flash_config().

These should be separate patches.  They're not related.

regards,
dan carpenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web