All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RESEND] scsi: sun_esp: fix device reference leaks
@ 2017-06-21  9:35 Johan Hovold
  2017-06-28  1:47 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2017-06-21  9:35 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: linux-scsi, linux-kernel, Johan Hovold, David S. Miller

Make sure to drop the reference to the dma device taken by
of_find_device_by_node() on probe errors and on driver unbind.

Fixes: 334ae614772b ("sparc: Kill SBUS DVMA layer.")
Signed-off-by: Johan Hovold <johan@kernel.org>
---

No comment to this one for over a month so resending. Also added David
Miller on CC.

Johan


 drivers/scsi/sun_esp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/sun_esp.c b/drivers/scsi/sun_esp.c
index 7b6d4c2087d7..747ee64a78e1 100644
--- a/drivers/scsi/sun_esp.c
+++ b/drivers/scsi/sun_esp.c
@@ -566,6 +566,7 @@ static int esp_sbus_probe(struct platform_device *op)
 	struct device_node *dp = op->dev.of_node;
 	struct platform_device *dma_of = NULL;
 	int hme = 0;
+	int ret;
 
 	if (dp->parent &&
 	    (!strcmp(dp->parent->name, "espdma") ||
@@ -580,7 +581,11 @@ static int esp_sbus_probe(struct platform_device *op)
 	if (!dma_of)
 		return -ENODEV;
 
-	return esp_sbus_probe_one(op, dma_of, hme);
+	ret = esp_sbus_probe_one(op, dma_of, hme);
+	if (ret)
+		put_device(&dma_of->dev);
+
+	return ret;
 }
 
 static int esp_sbus_remove(struct platform_device *op)
@@ -613,6 +618,8 @@ static int esp_sbus_remove(struct platform_device *op)
 
 	dev_set_drvdata(&op->dev, NULL);
 
+	put_device(&dma_of->dev);
+
 	return 0;
 }
 
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RESEND] scsi: sun_esp: fix device reference leaks
  2017-06-21  9:35 [PATCH RESEND] scsi: sun_esp: fix device reference leaks Johan Hovold
@ 2017-06-28  1:47 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2017-06-28  1:47 UTC (permalink / raw)
  To: Johan Hovold
  Cc: James E.J. Bottomley, Martin K. Petersen, linux-scsi,
	linux-kernel, David S. Miller


Johan,

> Make sure to drop the reference to the dma device taken by
> of_find_device_by_node() on probe errors and on driver unbind.

Looks good to me.

Applied to 4.13/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-28  1:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21  9:35 [PATCH RESEND] scsi: sun_esp: fix device reference leaks Johan Hovold
2017-06-28  1:47 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.