summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorVaishali Thakkar <vthakkar1994@gmail.com>2014-10-23 13:27:46 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-10-27 10:33:05 +0800
commite31a0e62803c64cab5e150b94c31364a1ce1d0fd (patch)
tree8abf0f73b64e4c88517ab492cbfe23211b89d455 /drivers/staging
parentd2b778712e3aa5258fabbb96ed05bcb073a1ce2e (diff)
downloadlinux-e31a0e62803c64cab5e150b94c31364a1ce1d0fd.tar.bz2
Staging: vme: devices: Use kasprintf
This patch uses kasprintf which combines kmalloc and sprintf. kasprintf also takes care of the size calculation. This is done using Coccinelle. Semantic patch used is as follows: @@ expression a,flag; expression list args; statement S; @@ a = - \(kmalloc\|kzalloc\)(...,flag) + kasprintf (flag,args) <... when != a if (a == NULL || ...) S ...> - sprintf(a,args); Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/vme/devices/vme_pio2_gpio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c b/drivers/staging/vme/devices/vme_pio2_gpio.c
index c64776f71809..da34d5529f51 100644
--- a/drivers/staging/vme/devices/vme_pio2_gpio.c
+++ b/drivers/staging/vme/devices/vme_pio2_gpio.c
@@ -191,11 +191,11 @@ int pio2_gpio_init(struct pio2_card *card)
int retval = 0;
char *label;
- label = kmalloc(PIO2_NUM_CHANNELS, GFP_KERNEL);
+ label = kasprintf(GFP_KERNEL,
+ "%s@%s", driver_name, dev_name(&card->vdev->dev));
if (label == NULL)
return -ENOMEM;
- sprintf(label, "%s@%s", driver_name, dev_name(&card->vdev->dev));
card->gc.label = label;
card->gc.ngpio = PIO2_NUM_CHANNELS;