env: sf: Free the old env_flash
authorJagan Teki <jagan@amarulasolutions.com>
Wed, 13 May 2020 11:02:42 +0000 (16:32 +0530)
committerJagan Teki <jagan@amarulasolutions.com>
Mon, 1 Jun 2020 12:25:24 +0000 (17:55 +0530)
commitc8cbf1707cba99cfdf1a6a33e03956a5a788183a
tree0bee986dd7142840810e82c827da8c272669619b
parentda37b539e62604d090fbc5b52246f8e810f2f9a7
env: sf: Free the old env_flash

env_flash is a global flash pointer, and the probe would
happen only if env_flash is NULL, but there is no checking
and free the pointer if is not NULL.

So, this patch frees the old env_flash, and get the probed
flash in to env_flash pointer and finally check if is not NULL.

Cc: Simon Glass <sjg@chromium.org>
Cc: Vignesh R <vigneshr@ti.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
env/sf.c