[S390] zcrypt: Free ap_device if dev_set_name fails.
authorFelix Beck <felix.beck@de.ibm.com>
Fri, 11 Sep 2009 08:28:52 +0000 (10:28 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 11 Sep 2009 08:29:51 +0000 (10:29 +0200)
If dev_set_name fails during scanning the AP bus, the reserved memory
has to be freed.

Signed-off-by: Felix Beck <felix.beck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/crypto/ap_bus.c

index 85785807acbce1ee2a0369a1ae4d2b3d8f3e0550..090b32a339c6042863862f8ab8006b7a47352896 100644 (file)
@@ -1111,8 +1111,11 @@ static void ap_scan_bus(struct work_struct *unused)
 
                ap_dev->device.bus = &ap_bus_type;
                ap_dev->device.parent = ap_root_device;
-               dev_set_name(&ap_dev->device, "card%02x",
-                            AP_QID_DEVICE(ap_dev->qid));
+               if (dev_set_name(&ap_dev->device, "card%02x",
+                                AP_QID_DEVICE(ap_dev->qid))) {
+                       kfree(ap_dev);
+                       continue;
+               }
                ap_dev->device.release = ap_device_release;
                rc = device_register(&ap_dev->device);
                if (rc) {