All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@foss.st.com>
To: u-boot@lists.denx.de
Subject: [RFC PATCH 1/2] env: sf: add missing spi_flash_free
Date: Wed, 24 Feb 2021 11:52:35 +0100	[thread overview]
Message-ID: <20210224115218.RFC.1.Ie56b2c6882d80bb19c6e899de5ddeca350a89d61@changeid> (raw)
In-Reply-To: <20210224105236.25663-1-patrick.delaunay@foss.st.com>

Free the SPI resources by calling spi_flash_free() in each env sf
function to avoid issue for other SPI users.

Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---

 env/sf.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/env/sf.c b/env/sf.c
index 6b61a4b8de..acbd712aef 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -149,6 +149,9 @@ static int env_sf_save(void)
 	printf("Valid environment: %d\n", (int)gd->env_valid);
 
 done:
+	spi_flash_free(env_flash);
+	env_flash = NULL;
+
 	if (saved_buffer)
 		free(saved_buffer);
 
@@ -246,6 +249,9 @@ static int env_sf_save(void)
 	puts("done\n");
 
 done:
+	spi_flash_free(env_flash);
+	env_flash = NULL;
+
 	if (saved_buffer)
 		free(saved_buffer);
 
@@ -404,6 +410,9 @@ static int env_sf_init_early(void)
 		gd->env_addr = (unsigned long)&tmp_env1->data;
 	}
 
+	spi_flash_free(env_flash);
+	env_flash = NULL;
+
 	return 0;
 err_read:
 	spi_flash_free(env_flash);
-- 
2.17.1

  reply	other threads:[~2021-02-24 10:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 10:52 [RFC PATCH 0/2] env: sf: remove the static env_flash variable Patrick Delaunay
2021-02-24 10:52 ` Patrick Delaunay [this message]
2021-04-18 12:45   ` [RFC PATCH 1/2] env: sf: add missing spi_flash_free Tom Rini
2021-02-24 10:52 ` [RFC PATCH 2/2] env: sf: remove the static env_flash variable Patrick Delaunay
2021-04-18 12:46   ` Tom Rini

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=20210224115218.RFC.1.Ie56b2c6882d80bb19c6e899de5ddeca350a89d61@changeid \
    --to=patrick.delaunay@foss.st.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.