Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1235411 > unrolled thread

[PATCH] misc: mic: replace kfree with put_device

Started byGeliang Tang <geliangtang@163.com>
First post2015-09-29 19:10 +0200
Last post2015-10-05 02:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] misc: mic: replace kfree with put_device Geliang Tang <geliangtang@163.com> - 2015-09-29 19:10 +0200
    Re: [PATCH] misc: mic: replace kfree with put_device Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-10-04 14:00 +0200
      [PATCH v2] misc: mic: replace kfree with put_device Geliang Tang <geliangtang@163.com> - 2015-10-05 02:40 +0200

#1235411 — [PATCH] misc: mic: replace kfree with put_device

FromGeliang Tang <geliangtang@163.com>
Date2015-09-29 19:10 +0200
Subject[PATCH] misc: mic: replace kfree with put_device
Message-ID<qe6zE-4i6-17@gated-at.bofh.it>
Handle a failed device_register(), replace kfree() with put_device(),
which will call mbus_release_dev() or scif_release_dev().

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/misc/mic/bus/mic_bus.c  | 2 +-
 drivers/misc/mic/bus/scif_bus.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/mic/bus/mic_bus.c b/drivers/misc/mic/bus/mic_bus.c
index 961ae90..a25be8d 100644
--- a/drivers/misc/mic/bus/mic_bus.c
+++ b/drivers/misc/mic/bus/mic_bus.c
@@ -185,7 +185,7 @@ mbus_register_device(struct device *pdev, int id, struct dma_map_ops *dma_ops,
 ida_remove:
 	ida_simple_remove(&mbus_index_ida, mbdev->index);
 free_mbdev:
-	kfree(mbdev);
+	put_device(&mbdev->dev);
 	return ERR_PTR(ret);
 }
 EXPORT_SYMBOL_GPL(mbus_register_device);
diff --git a/drivers/misc/mic/bus/scif_bus.c b/drivers/misc/mic/bus/scif_bus.c
index 2da7cee..8972ae7 100644
--- a/drivers/misc/mic/bus/scif_bus.c
+++ b/drivers/misc/mic/bus/scif_bus.c
@@ -181,7 +181,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);
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1239102

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2015-10-04 14:00 +0200
Message-ID<qfQ7n-7Tm-1@gated-at.bofh.it>
In reply to#1235411
On Wed, Sep 30, 2015 at 12:58:22AM +0800, Geliang Tang wrote:
> Handle a failed device_register(), replace kfree() with put_device(),
> which will call mbus_release_dev() or scif_release_dev().
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>  drivers/misc/mic/bus/mic_bus.c  | 2 +-
>  drivers/misc/mic/bus/scif_bus.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)

Due to the recent changes in this driver, this patch doesn't apply
anymore.  Can you please refresh it and resend?

thanks,

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1239241 — [PATCH v2] misc: mic: replace kfree with put_device

FromGeliang Tang <geliangtang@163.com>
Date2015-10-05 02:40 +0200
Subject[PATCH v2] misc: mic: replace kfree with put_device
Message-ID<qg1YS-83M-5@gated-at.bofh.it>
In reply to#1239102
Handle a failed device_register(), replace kfree() with put_device(),
which will call mbus_release_dev() or scif_release_dev().

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
Changes in v2:
  - Just refresh this patch.
---
 drivers/misc/mic/bus/mic_bus.c  | 2 +-
 drivers/misc/mic/bus/scif_bus.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/mic/bus/mic_bus.c b/drivers/misc/mic/bus/mic_bus.c
index c64955d..be37890 100644
--- a/drivers/misc/mic/bus/mic_bus.c
+++ b/drivers/misc/mic/bus/mic_bus.c
@@ -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);
diff --git a/drivers/misc/mic/bus/scif_bus.c b/drivers/misc/mic/bus/scif_bus.c
index fd27021..ff6e01c 100644
--- a/drivers/misc/mic/bus/scif_bus.c
+++ b/drivers/misc/mic/bus/scif_bus.c
@@ -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);
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web