* [PATCH] slimbus: core: use put_device() instead of kfree()
@ 2018-03-09 14:09 srinivas.kandagatla
0 siblings, 0 replies; 3+ messages in thread
From: srinivas.kandagatla @ 2018-03-09 14:09 UTC (permalink / raw)
To: gregkh; +Cc: linux-kernel, srinivas.kandagatla, Arvind Yadav
From: Arvind Yadav <arvind.yadav.cs@gmail.com>
Never directly free @dev after calling device_register(), even
if it returned an error! Always use put_device() to give up the
reference initialized.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
Hi Greg,
Can you pick this single slimbus patch for 4.17 merge cycle.
Thanks,
srini
drivers/slimbus/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 4988a8f4d905..7ddfc675b131 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -141,7 +141,7 @@ static struct slim_device *slim_alloc_device(struct slim_controller *ctrl,
sbdev->e_addr = *eaddr;
ret = slim_add_device(ctrl, sbdev, node);
if (ret) {
- kfree(sbdev);
+ put_device(&sbdev->dev);
return NULL;
}
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] slimbus: core: use put_device() instead of kfree()
2018-03-07 10:22 Arvind Yadav
@ 2018-03-07 10:45 ` Srinivas Kandagatla
0 siblings, 0 replies; 3+ messages in thread
From: Srinivas Kandagatla @ 2018-03-07 10:45 UTC (permalink / raw)
To: Arvind Yadav, broonie, gregkh; +Cc: linux-kernel, alsa-devel
On 07/03/18 10:22, Arvind Yadav wrote:
> Never directly free @dev after calling device_register(), even
> if it returned an error! Always use put_device() to give up the
> reference initialized.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
> ---
> drivers/slimbus/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Looks good for me,
Will queue it up.
> diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
> index 4988a8f..7ddfc67 100644
> --- a/drivers/slimbus/core.c
> +++ b/drivers/slimbus/core.c
> @@ -141,7 +141,7 @@ static struct slim_device *slim_alloc_device(struct slim_controller *ctrl,
> sbdev->e_addr = *eaddr;
> ret = slim_add_device(ctrl, sbdev, node);
> if (ret) {
> - kfree(sbdev);
> + put_device(&sbdev->dev);
> return NULL;
> }
>
>
thanks,
srini
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] slimbus: core: use put_device() instead of kfree()
@ 2018-03-07 10:22 Arvind Yadav
2018-03-07 10:45 ` Srinivas Kandagatla
0 siblings, 1 reply; 3+ messages in thread
From: Arvind Yadav @ 2018-03-07 10:22 UTC (permalink / raw)
To: srinivas.kandagatla, broonie, gregkh; +Cc: linux-kernel, alsa-devel
Never directly free @dev after calling device_register(), even
if it returned an error! Always use put_device() to give up the
reference initialized.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
drivers/slimbus/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/slimbus/core.c b/drivers/slimbus/core.c
index 4988a8f..7ddfc67 100644
--- a/drivers/slimbus/core.c
+++ b/drivers/slimbus/core.c
@@ -141,7 +141,7 @@ static struct slim_device *slim_alloc_device(struct slim_controller *ctrl,
sbdev->e_addr = *eaddr;
ret = slim_add_device(ctrl, sbdev, node);
if (ret) {
- kfree(sbdev);
+ put_device(&sbdev->dev);
return NULL;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-09 14:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 14:09 [PATCH] slimbus: core: use put_device() instead of kfree() srinivas.kandagatla
-- strict thread matches above, loose matches on Subject: below --
2018-03-07 10:22 Arvind Yadav
2018-03-07 10:45 ` Srinivas Kandagatla
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).