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


Groups > linux.kernel > #1273956 > unrolled thread

[PATCH] efi/esrt: don't preformat name

Started byRasmus Villemoes <linux@rasmusvillemoes.dk>
First post2015-11-20 11:40 +0100
Last post2015-11-26 11:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] efi/esrt: don't preformat name Rasmus Villemoes <linux@rasmusvillemoes.dk> - 2015-11-20 11:40 +0100
    Re: [PATCH] efi/esrt: don't preformat name Matt Fleming <matt@codeblueprint.co.uk> - 2015-11-26 11:30 +0100

#1273956 — [PATCH] efi/esrt: don't preformat name

FromRasmus Villemoes <linux@rasmusvillemoes.dk>
Date2015-11-20 11:40 +0100
Subject[PATCH] efi/esrt: don't preformat name
Message-ID<qwRgJ-60g-5@gated-at.bofh.it>
kobject_init_and_add takes a format string+args, so there's no reason
to do this formatting in advance.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/firmware/efi/esrt.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
index 22c5285f7705..75feb3f5829b 100644
--- a/drivers/firmware/efi/esrt.c
+++ b/drivers/firmware/efi/esrt.c
@@ -167,14 +167,11 @@ static struct kset *esrt_kset;
 static int esre_create_sysfs_entry(void *esre, int entry_num)
 {
 	struct esre_entry *entry;
-	char name[20];
 
 	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
 	if (!entry)
 		return -ENOMEM;
 
-	sprintf(name, "entry%d", entry_num);
-
 	entry->kobj.kset = esrt_kset;
 
 	if (esrt->fw_resource_version == 1) {
@@ -182,7 +179,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
 
 		entry->esre.esre1 = esre;
 		rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
-					  "%s", name);
+					  "entry%d", entry_num);
 		if (rc) {
 			kfree(entry);
 			return rc;
-- 
2.6.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1278135

FromMatt Fleming <matt@codeblueprint.co.uk>
Date2015-11-26 11:30 +0100
Message-ID<qz1Ym-3Qr-23@gated-at.bofh.it>
In reply to#1273956
On Fri, 20 Nov, at 11:30:17AM, Rasmus Villemoes wrote:
> kobject_init_and_add takes a format string+args, so there's no reason
> to do this formatting in advance.
> 
> Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> ---
>  drivers/firmware/efi/esrt.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
 
Looks good to me. Thanks applied!

> diff --git a/drivers/firmware/efi/esrt.c b/drivers/firmware/efi/esrt.c
> index 22c5285f7705..75feb3f5829b 100644
> --- a/drivers/firmware/efi/esrt.c
> +++ b/drivers/firmware/efi/esrt.c
> @@ -167,14 +167,11 @@ static struct kset *esrt_kset;
>  static int esre_create_sysfs_entry(void *esre, int entry_num)
>  {
>  	struct esre_entry *entry;
> -	char name[20];
>  
>  	entry = kzalloc(sizeof(*entry), GFP_KERNEL);
>  	if (!entry)
>  		return -ENOMEM;
>  
> -	sprintf(name, "entry%d", entry_num);
> -
>  	entry->kobj.kset = esrt_kset;
>  
>  	if (esrt->fw_resource_version == 1) {
> @@ -182,7 +179,7 @@ static int esre_create_sysfs_entry(void *esre, int entry_num)
>  
>  		entry->esre.esre1 = esre;
>  		rc = kobject_init_and_add(&entry->kobj, &esre1_ktype, NULL,
> -					  "%s", name);
> +					  "entry%d", entry_num);
>  		if (rc) {
>  			kfree(entry);
>  			return rc;
> -- 
> 2.6.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web