Dear Patrick, In message <20200331180330.3.I8f6df6d28ce5b4b601ced711af3699d95e1576fb@changeid> you wrote: > Serial number is first checked and, in case of mismatch, all > environment variables are reset to their default value. > > This patch allows to detect that environment is saved in a removable > device, as a SD card, and reused on a other board, potentially with > incompatible variables. > > Signed-off-by: Patrick Delaunay <patrick.delau...@st.com> > --- > > arch/arm/mach-stm32mp/cpu.c | 20 +++++++++++++++----- > 1 file changed, 15 insertions(+), 5 deletions(-) > > diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c > index 9aa5794334..365c2aa4f7 100644 > --- a/arch/arm/mach-stm32mp/cpu.c > +++ b/arch/arm/mach-stm32mp/cpu.c > @@ -511,8 +511,9 @@ __weak int setup_mac_address(void) > return -EINVAL; > } > pr_debug("OTP MAC address = %pM\n", enetaddr); > - ret = !eth_env_set_enetaddr("ethaddr", enetaddr); > - if (!ret) > + > + ret = eth_env_set_enetaddr("ethaddr", enetaddr); > + if (ret) > pr_err("Failed to set mac address %pM from OTP: %d\n", > enetaddr, ret);
This is an unrelated and totally undocumented change. Please split into separate commit. > + > + if (serial_env) { > + if (!strcmp(serial_string, serial_env)) > + return 0; > + /* For invalid enviromnent (serial# change), reset to default */ > + env_set_default("serial number mismatch", 0); > + } Resetting the enviropnment to the defaults means you drop all setting sa user may have made. This is a very bad move - as a user I find such things completely unacceptable. If I make any changes, they must never ever be killed without my explicit confirmation. I strongly advice against such a method. Please drop that. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de "You ain't experienced..." "Well, nor are you." "That's true. But the point is ... the point is ... the point is we've been not experienced for a lot longer than you. We've got a lot of experience of not having any experience." - Terry Pratchett, _Witches Abroad_