staging: vme: Simplfy string usage in vme_user_probe()
authorBojan Prtvar <prtvar.b@gmail.com>
Thu, 3 Apr 2014 16:56:10 +0000 (18:56 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Apr 2014 23:21:05 +0000 (16:21 -0700)
We can avoid usage of sprintf() and magic-sized array with simple pointer assignment.

Signed-off-by: Bojan Prtvar <prtvar.b@gmail.com>
Reviewed-by: wharms <wharms@bfs.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vme/devices/vme_user.c

index 481192a2f4e241c5083354e756c8db12eec85db0..5fa7f831dabd4a09e9e82e7135dcfc80c9ca448c 100644 (file)
@@ -684,7 +684,7 @@ static int vme_user_match(struct vme_dev *vdev)
 static int vme_user_probe(struct vme_dev *vdev)
 {
        int i, err;
-       char name[12];
+       char *name;
 
        /* Save pointer to the bridge device */
        if (vme_user_bridge != NULL) {
@@ -794,13 +794,13 @@ static int vme_user_probe(struct vme_dev *vdev)
 
                switch (type[i]) {
                case MASTER_MINOR:
-                       sprintf(name, "bus/vme/m%%d");
+                       name = "bus/vme/m%d";
                        break;
                case CONTROL_MINOR:
-                       sprintf(name, "bus/vme/ctl");
+                       name = "bus/vme/ctl";
                        break;
                case SLAVE_MINOR:
-                       sprintf(name, "bus/vme/s%%d");
+                       name = "bus/vme/s%d";
                        break;
                default:
                        err = -EINVAL;