Commit 3ecb4d85 authored by Christophe JAILLET's avatar Christophe JAILLET Committed by Hans de Goede

platform/x86/dell: alienware-wmi: Use kasprintf()

Use kasprintf() instead of hand writing it.
This saves the need of an intermediate buffer.
Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f2b2c9e5d80550e480a627c1b2139d5cc9472ffa.1699775015.git.christophe.jaillet@wanadoo.frReviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent 93ec6f22
...@@ -429,7 +429,6 @@ static DEVICE_ATTR(lighting_control_state, 0644, show_control_state, ...@@ -429,7 +429,6 @@ static DEVICE_ATTR(lighting_control_state, 0644, show_control_state,
static int alienware_zone_init(struct platform_device *dev) static int alienware_zone_init(struct platform_device *dev)
{ {
u8 zone; u8 zone;
char buffer[10];
char *name; char *name;
if (interface == WMAX) { if (interface == WMAX) {
...@@ -466,8 +465,7 @@ static int alienware_zone_init(struct platform_device *dev) ...@@ -466,8 +465,7 @@ static int alienware_zone_init(struct platform_device *dev)
return -ENOMEM; return -ENOMEM;
for (zone = 0; zone < quirks->num_zones; zone++) { for (zone = 0; zone < quirks->num_zones; zone++) {
sprintf(buffer, "zone%02hhX", zone); name = kasprintf(GFP_KERNEL, "zone%02hhX", zone);
name = kstrdup(buffer, GFP_KERNEL);
if (name == NULL) if (name == NULL)
return 1; return 1;
sysfs_attr_init(&zone_dev_attrs[zone].attr); sysfs_attr_init(&zone_dev_attrs[zone].attr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment