mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 1/8] regmap-mmio: don't call kfree on non kmalloc allocated buffers
Date: Tue, 16 Jul 2024 13:58:27 +0200	[thread overview]
Message-ID: <20240716115834.1958413-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240716115834.1958413-1-a.fatoum@pengutronix.de>

If we don't use kmalloc() or friends, we shouldn't use kfree() to free
the buffer either.

Currently, kfree and free are identical, but they are defined in
different headers.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/base/regmap/regmap-mmio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/base/regmap/regmap-mmio.c b/drivers/base/regmap/regmap-mmio.c
index 01b0a9963110..9d2ab9cb8dc7 100644
--- a/drivers/base/regmap/regmap-mmio.c
+++ b/drivers/base/regmap/regmap-mmio.c
@@ -7,6 +7,7 @@
 #include <linux/clk.h>
 #include <linux/err.h>
 #include <io.h>
+#include <malloc.h>
 #include <linux/regmap.h>
 
 #include "internal.h"
@@ -272,7 +273,7 @@ static struct regmap_mmio_context *regmap_mmio_gen_context(struct device *dev,
 	return ctx;
 
 err_free:
-	kfree(ctx);
+	free(ctx);
 
 	return ERR_PTR(ret);
 }
@@ -293,7 +294,7 @@ struct regmap *regmap_init_mmio_clk(struct device *dev,
 
 		clk = clk_get(dev, clk_id);
 		if (IS_ERR(clk)) {
-			kfree(ctx);
+			free(ctx);
 			return ERR_CAST(clk);
 		}
 
-- 
2.39.2




  reply	other threads:[~2024-07-16 11:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-16 11:58 [PATCH 0/8] include: list: remove dependency on linux/kernel.h Ahmad Fatoum
2024-07-16 11:58 ` Ahmad Fatoum [this message]
2024-07-16 11:58 ` [PATCH 2/8] treewide: fix dependency on indirectly included linux/kernel.h Ahmad Fatoum
2024-07-16 11:58 ` [PATCH 3/8] stringlist: make header self-contained Ahmad Fatoum
2024-07-16 11:58 ` [PATCH 4/8] module: retire MODULE_SYMBOL_PREFIX Ahmad Fatoum
2024-07-16 11:58 ` [PATCH 5/8] include: move MODULE_* macro definitions into own header Ahmad Fatoum
2024-07-16 11:58 ` [PATCH 6/8] include: asm-generic/bug: break recursive dependency Ahmad Fatoum
2024-07-16 11:58 ` [PATCH 7/8] include: linux/kernel.h: split off into multiple headers Ahmad Fatoum
2024-07-16 11:58 ` [PATCH 8/8] include: list: replace full kernel.h inclusion with smaller container_of.h Ahmad Fatoum
2024-07-19  6:31 ` [PATCH 0/8] include: list: remove dependency on linux/kernel.h Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240716115834.1958413-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox