misc: mic: replace kfree with put_device
authorGeliang Tang <geliangtang@163.com>
Mon, 12 Oct 2015 04:05:13 +0000 (21:05 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 Oct 2015 04:42:29 +0000 (21:42 -0700)
Handle a failed device_register(), replace kfree() with put_device(),
which will call cosm/mbus/scif_release_dev().

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/mic/bus/cosm_bus.c
drivers/misc/mic/bus/mic_bus.c
drivers/misc/mic/bus/scif_bus.c

index 1e36830f1a4eae3449ee6ebe1060d817608067c1..d31d6c6e6cb1550e77b0dc63060f2684e6862600 100644 (file)
@@ -100,7 +100,7 @@ cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops)
 ida_remove:
        ida_simple_remove(&cosm_index_ida, cdev->index);
 free_cdev:
-       kfree(cdev);
+       put_device(&cdev->dev);
        return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(cosm_register_device);
index c64955d8cbc1d8a66d4e0e7cc8ad881f161f516b..be37890abb93d3897c7e000184c65567a31ed2a9 100644 (file)
@@ -175,7 +175,7 @@ mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
                goto free_mbdev;
        return mbdev;
 free_mbdev:
-       kfree(mbdev);
+       put_device(&mbdev->dev);
        return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(mbus_register_device);
index fd2702143022b6ad2f015c8f87137f3367614318..ff6e01c258101f8527f75be845d1984323a72717 100644 (file)
@@ -180,7 +180,7 @@ scif_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
                goto free_sdev;
        return sdev;
 free_sdev:
-       kfree(sdev);
+       put_device(&sdev->dev);
        return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(scif_register_device);