rapidio: fix possible name leaks when rio_add_device() fails
[linux-2.6-microblaze.git] / drivers / rapidio / devices / rio_mport_cdev.c
index 2cdc054..3cc8399 100644 (file)
@@ -1804,8 +1804,11 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv,
                rio_init_dbell_res(&rdev->riores[RIO_DOORBELL_RESOURCE],
                                   0, 0xffff);
        err = rio_add_device(rdev);
-       if (err)
-               goto cleanup;
+       if (err) {
+               put_device(&rdev->dev);
+               return err;
+       }
+
        rio_dev_get(rdev);
 
        return 0;