linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: remove redundant put_device
@ 2019-07-17 10:05 Ding Xiang
  2019-07-17 11:11 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Ding Xiang @ 2019-07-17 10:05 UTC (permalink / raw)
  To: broonie; +Cc: linux-spi, linux-kernel

device_unregister will call put_device,
so remove the redundant put_device

Signed-off-by: Ding Xiang <dingxiang@cmss.chinamobile.com>
---
 drivers/spi/spi.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 75ac046..d753689 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2133,11 +2133,9 @@ static ssize_t spi_slave_store(struct device *dev,
 		return -EINVAL;
 
 	child = device_find_child(&ctlr->dev, NULL, match_true);
-	if (child) {
+	if (child)
 		/* Remove registered slave */
 		device_unregister(child);
-		put_device(child);
-	}
 
 	if (strcmp(name, "(null)")) {
 		/* Register new slave */
-- 
1.9.1




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

* Re: [PATCH] spi: remove redundant put_device
  2019-07-17 10:05 [PATCH] spi: remove redundant put_device Ding Xiang
@ 2019-07-17 11:11 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2019-07-17 11:11 UTC (permalink / raw)
  To: Ding Xiang; +Cc: linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

On Wed, Jul 17, 2019 at 06:05:44PM +0800, Ding Xiang wrote:

> device_unregister will call put_device,
> so remove the redundant put_device

>  	child = device_find_child(&ctlr->dev, NULL, match_true);
> -	if (child) {
> +	if (child)
>  		/* Remove registered slave */
>  		device_unregister(child);
> -		put_device(child);
> -	}

That's to undo the extra get we have from device_find_child(),
not to undo part of the registration.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-07-17 11:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 10:05 [PATCH] spi: remove redundant put_device Ding Xiang
2019-07-17 11:11 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).