mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jules Maselbas <jmaselbas@kalray.eu>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@kalray.eu>
Subject: [PATCH 2/3] soc: kvx: Fix memory leaks
Date: Tue, 11 Jul 2023 11:11:22 +0200	[thread overview]
Message-ID: <20230711091123.19111-2-jmaselbas@kalray.eu> (raw)
In-Reply-To: <20230711091123.19111-1-jmaselbas@kalray.eu>

When calling nvmem_cell_get_and_read the resulting memory must be freed.

Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
 drivers/soc/kvx/kvx_socinfo.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/soc/kvx/kvx_socinfo.c b/drivers/soc/kvx/kvx_socinfo.c
index fc7ba1c1b9..496e817755 100644
--- a/drivers/soc/kvx/kvx_socinfo.c
+++ b/drivers/soc/kvx/kvx_socinfo.c
@@ -102,6 +102,7 @@ static int kvx_read_mppa_id(struct device_node *socinfo)
 	ews_val = (ews_val >> 32) | (ews_val << 32);
 	wafer_id = (ews_val >> EWS_WAFER_ID_SHIFT) & EWS_WAFER_ID_MASK;
 	base38_decode(lot_id, ews_val & EWS_LOT_ID_MASK, LOT_ID_STR_LEN);
+	free(cell_val64);
 
 	cell_val32 = (u32 *) nvmem_cell_get_and_read(socinfo, "ft_fuse", 4);
 	if (IS_ERR(cell_val32)) {
@@ -112,6 +113,7 @@ static int kvx_read_mppa_id(struct device_node *socinfo)
 	ft_val = *cell_val32;
 	device_id = (ft_val >> FT_DEVICE_ID_SHIFT) & FT_DEVICE_ID_MASK;
 	base38_decode(&com_ap, (ft_val >> FT_COM_AP_SHIFT) & FT_COM_AP_MASK, 1);
+	free(cell_val32);
 
 	kvx_mppa_id = basprintf("%sA-%d%c-%03d", lot_id, wafer_id, com_ap,
 			       device_id);
-- 
2.17.1








  reply	other threads:[~2023-07-11  9:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11  9:11 [PATCH 1/3] soc: kvx: Rename function to match global variable Jules Maselbas
2023-07-11  9:11 ` Jules Maselbas [this message]
2023-07-11  9:11 ` [PATCH 3/3] soc: kvx: Add board_sn global var from OTP Jules Maselbas
2023-07-26 12:26   ` Sascha Hauer
2023-07-26 19:00     ` Jules Maselbas
2023-07-26 12:18 ` [PATCH 1/3] soc: kvx: Rename function to match global variable 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=20230711091123.19111-2-jmaselbas@kalray.eu \
    --to=jmaselbas@kalray.eu \
    --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