diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2023-11-12 10:44:15 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-11-20 16:05:04 +0300 |
commit | 3ecb4d85461a34323a849769030841533fcd0395 (patch) | |
tree | 3668c276482aece707636c64416f12771e76457e /drivers/platform/x86/dell | |
parent | 93ec6f222c680cef282a2e94fc42a130d34179b2 (diff) | |
download | linux-3ecb4d85461a34323a849769030841533fcd0395.tar.xz |
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: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/f2b2c9e5d80550e480a627c1b2139d5cc9472ffa.1699775015.git.christophe.jaillet@wanadoo.fr
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'drivers/platform/x86/dell')
-rw-r--r-- | drivers/platform/x86/dell/alienware-wmi.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index a9477e5432e4..f5ee62ce1753 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -429,7 +429,6 @@ static DEVICE_ATTR(lighting_control_state, 0644, show_control_state, static int alienware_zone_init(struct platform_device *dev) { u8 zone; - char buffer[10]; char *name; if (interface == WMAX) { @@ -466,8 +465,7 @@ static int alienware_zone_init(struct platform_device *dev) return -ENOMEM; for (zone = 0; zone < quirks->num_zones; zone++) { - sprintf(buffer, "zone%02hhX", zone); - name = kstrdup(buffer, GFP_KERNEL); + name = kasprintf(GFP_KERNEL, "zone%02hhX", zone); if (name == NULL) return 1; sysfs_attr_init(&zone_dev_attrs[zone].attr); |