[PATCH 1/8] regmap-mmio: don't call kfree on non kmalloc allocated buffers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux