* [PATCH v2] ssb: use put_device() if device_register fail
@ 2018-03-08 5:09 Arvind Yadav
2018-03-08 6:11 ` Michael Büsch
0 siblings, 1 reply; 2+ messages in thread
From: Arvind Yadav @ 2018-03-08 5:09 UTC (permalink / raw)
To: m; +Cc: linux-kernel, linux-wireless
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>
---
changes in v2:
Removed kfree() call for @dev.
drivers/ssb/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index 65420a9..a7a062b 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -521,8 +521,8 @@ static int ssb_devices_register(struct ssb_bus *bus)
ssb_err("Could not register %s\n", dev_name(dev));
/* Set dev to NULL to not unregister
* dev on error unwinding. */
+ put_device(dev);
sdev->dev = NULL;
- kfree(devwrap);
goto error;
}
dev_idx++;
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2] ssb: use put_device() if device_register fail
2018-03-08 5:09 [PATCH v2] ssb: use put_device() if device_register fail Arvind Yadav
@ 2018-03-08 6:11 ` Michael Büsch
0 siblings, 0 replies; 2+ messages in thread
From: Michael Büsch @ 2018-03-08 6:11 UTC (permalink / raw)
To: Arvind Yadav; +Cc: linux-kernel, linux-wireless
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
On Thu, 8 Mar 2018 10:39:49 +0530
Arvind Yadav <arvind.yadav.cs@gmail.com> 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>
> ---
> changes in v2:
> Removed kfree() call for @dev.
>
> drivers/ssb/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
> index 65420a9..a7a062b 100644
> --- a/drivers/ssb/main.c
> +++ b/drivers/ssb/main.c
> @@ -521,8 +521,8 @@ static int ssb_devices_register(struct ssb_bus *bus)
> ssb_err("Could not register %s\n", dev_name(dev));
> /* Set dev to NULL to not unregister
> * dev on error unwinding. */
> + put_device(dev);
> sdev->dev = NULL;
> - kfree(devwrap);
> goto error;
> }
> dev_idx++;
Would you please put the put_device where the kfree was?
So that the comment still matches.
Thanks.
--
Michael
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-08 6:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-08 5:09 [PATCH v2] ssb: use put_device() if device_register fail Arvind Yadav
2018-03-08 6:11 ` Michael Büsch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox