summaryrefslogtreecommitdiffstats
path: root/net/atm
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-03-18 13:48:26 +0000
committerDavid S. Miller <davem@davemloft.net>2010-03-21 18:34:15 -0700
commit62c97ac04a67c120ec37a9bfd445a8d5dbbc1ed2 (patch)
tree8195733812f43e1bb547e916fb718b3135c67eb8 /net/atm
parent283f2fe87e980d8af5ad8aa63751e7e3258ee05a (diff)
downloadlinux-62c97ac04a67c120ec37a9bfd445a8d5dbbc1ed2.tar.gz
linux-62c97ac04a67c120ec37a9bfd445a8d5dbbc1ed2.tar.bz2
linux-62c97ac04a67c120ec37a9bfd445a8d5dbbc1ed2.zip
atm: Use kasprintf
Use kasprintf in atm_proc_dev_register() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm')
-rw-r--r--net/atm/proc.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/net/atm/proc.c b/net/atm/proc.c
index 7a96b2376bd7..f188a399c679 100644
--- a/net/atm/proc.c
+++ b/net/atm/proc.c
@@ -406,7 +406,6 @@ EXPORT_SYMBOL(atm_proc_root);
int atm_proc_dev_register(struct atm_dev *dev)
{
- int digits, num;
int error;
/* No proc info */
@@ -414,16 +413,9 @@ int atm_proc_dev_register(struct atm_dev *dev)
return 0;
error = -ENOMEM;
- digits = 0;
- for (num = dev->number; num; num /= 10)
- digits++;
- if (!digits)
- digits++;
-
- dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_KERNEL);
+ dev->proc_name = kasprintf(GFP_KERNEL, "%s:%d", dev->type, dev->number);
if (!dev->proc_name)
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,
&proc_atm_dev_ops, dev);