Commit 3683e9e8 authored by Himanshu Jha's avatar Himanshu Jha Committed by Lee Jones

mfd: ab8500-debugfs: Use kasprintf

Use kasprintf instead of combination of kmalloc and sprintf.
Signed-off-by: default avatarHimanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 500f9ff5
...@@ -2519,11 +2519,10 @@ static ssize_t ab8500_subscribe_write(struct file *file, ...@@ -2519,11 +2519,10 @@ static ssize_t ab8500_subscribe_write(struct file *file,
if (!dev_attr[irq_index]) if (!dev_attr[irq_index])
return -ENOMEM; return -ENOMEM;
event_name[irq_index] = kmalloc(count, GFP_KERNEL); event_name[irq_index] = kasprintf(GFP_KERNEL, "%lu", user_val);
if (!event_name[irq_index]) if (!event_name[irq_index])
return -ENOMEM; return -ENOMEM;
sprintf(event_name[irq_index], "%lu", user_val);
dev_attr[irq_index]->show = show_irq; dev_attr[irq_index]->show = show_irq;
dev_attr[irq_index]->store = NULL; dev_attr[irq_index]->store = NULL;
dev_attr[irq_index]->attr.name = event_name[irq_index]; dev_attr[irq_index]->attr.name = event_name[irq_index];
......
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