Commit 62c97ac0 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

atm: Use kasprintf

Use kasprintf in atm_proc_dev_register()
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 283f2fe8
...@@ -406,7 +406,6 @@ EXPORT_SYMBOL(atm_proc_root); ...@@ -406,7 +406,6 @@ EXPORT_SYMBOL(atm_proc_root);
int atm_proc_dev_register(struct atm_dev *dev) int atm_proc_dev_register(struct atm_dev *dev)
{ {
int digits, num;
int error; int error;
/* No proc info */ /* No proc info */
...@@ -414,16 +413,9 @@ int atm_proc_dev_register(struct atm_dev *dev) ...@@ -414,16 +413,9 @@ int atm_proc_dev_register(struct atm_dev *dev)
return 0; return 0;
error = -ENOMEM; error = -ENOMEM;
digits = 0; dev->proc_name = kasprintf(GFP_KERNEL, "%s:%d", dev->type, dev->number);
for (num = dev->number; num; num /= 10)
digits++;
if (!digits)
digits++;
dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_KERNEL);
if (!dev->proc_name) if (!dev->proc_name)
goto err_out; goto err_out;
sprintf(dev->proc_name, "%s:%d", dev->type, dev->number);
dev->proc_entry = proc_create_data(dev->proc_name, 0, atm_proc_root, dev->proc_entry = proc_create_data(dev->proc_name, 0, atm_proc_root,
&proc_atm_dev_ops, dev); &proc_atm_dev_ops, dev);
......
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