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


Groups > linux.kernel > #1195481 > unrolled thread

[PATCH] firmware: fix wrong memory deallocation in fw_add_devm_name()

Started byVladimir Zapolskiy <vz@mleia.com>
First post2015-07-29 22:30 +0200
Last post2015-07-30 09:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] firmware: fix wrong memory deallocation in fw_add_devm_name() Vladimir Zapolskiy <vz@mleia.com> - 2015-07-29 22:30 +0200
    Re: [PATCH] firmware: fix wrong memory deallocation in fw_add_devm_name() Ming Lei <ming.lei@canonical.com> - 2015-07-30 09:50 +0200

#1195481 — [PATCH] firmware: fix wrong memory deallocation in fw_add_devm_name()

FromVladimir Zapolskiy <vz@mleia.com>
Date2015-07-29 22:30 +0200
Subject[PATCH] firmware: fix wrong memory deallocation in fw_add_devm_name()
Message-ID<pRG9c-1VI-15@gated-at.bofh.it>
Device resource data allocated with devres_alloc() must be deallocated
by devres_free().

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
---
 drivers/base/firmware_class.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 894bda1..8524450 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -443,7 +443,7 @@ static int fw_add_devm_name(struct device *dev, const char *name)
 		return -ENOMEM;
 	fwn->name = kstrdup_const(name, GFP_KERNEL);
 	if (!fwn->name) {
-		kfree(fwn);
+		devres_free(fwn);
 		return -ENOMEM;
 	}
 
-- 
2.1.4

--
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]


#1195772

FromMing Lei <ming.lei@canonical.com>
Date2015-07-30 09:50 +0200
Message-ID<pRQLh-gS-31@gated-at.bofh.it>
In reply to#1195481
On Wed, Jul 29, 2015 at 4:26 PM, Vladimir Zapolskiy <vz@mleia.com> wrote:
> Device resource data allocated with devres_alloc() must be deallocated
> by devres_free().
>
> Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>

Acked-by: Ming Lei <ming.lei@canonical.com>

> ---
>  drivers/base/firmware_class.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 894bda1..8524450 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -443,7 +443,7 @@ static int fw_add_devm_name(struct device *dev, const char *name)
>                 return -ENOMEM;
>         fwn->name = kstrdup_const(name, GFP_KERNEL);
>         if (!fwn->name) {
> -               kfree(fwn);
> +               devres_free(fwn);
>                 return -ENOMEM;
>         }
>
> --
> 2.1.4
>
--
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