Message ID | 20210126131412.3567-10-michael.adler@siemens.com |
---|---|
State | Changes Requested |
Headers | show |
Series | Overhaul swupdate.cfg handling | expand |
On 26.01.21 14:14, Michael Adler wrote: > Signed-off-by: Michael Adler <michael.adler@siemens.com> > Signed-off-by: Christian Storm <christian.storm@siemens.com> > --- > core/artifacts_versions.c | 21 ++++++--------------- > 1 file changed, 6 insertions(+), 15 deletions(-) > > diff --git a/core/artifacts_versions.c b/core/artifacts_versions.c > index 6074c33..63350d2 100644 > --- a/core/artifacts_versions.c > +++ b/core/artifacts_versions.c > @@ -131,21 +131,12 @@ static int versions_settings(void *setting, void *data) > > void get_sw_versions(swupdate_cfg_handle *handle, struct swupdate_cfg *sw) > { > - int ret = -EINVAL; > - > - /* > - * Try to read versions from configuration file > - * If not found, fall back to a legacy file > - * in the format "<image name> <version>" > - */ > - if (handle != NULL) > - ret = swupdate_cfg_read_module_settings(handle, "versions", > - versions_settings, > - sw); > - > - if (ret) > - ret = read_sw_version_file(sw); > - > + // Try to read versions from configuration file > + if (handle != NULL && swupdate_cfg_read_module_settings(handle, "versions", versions_settings, sw) == 0) { > + return; > + } > + // If not found, fall back to a legacy file in the format "<image name> <version>" > + read_sw_version_file(sw); > } > #else Much more readable - just codestyle, SWUpdate is a C project and comments are enclosed in /* */ Best regards, Stefano
Hi Stefano, > Much more readable - just codestyle, SWUpdate is a C project and > comments are enclosed in /* */ thanks :) No problem, I will change it. Shall I send an updated patch as reply to this thread, or shall I wait until I have addressed the other comments and send a PATCH v2 series then, containing all the patches again? Kind regards, Michael
On 26.01.21 16:14, Michael Adler wrote: > Hi Stefano, > >> Much more readable - just codestyle, SWUpdate is a C project and >> comments are enclosed in /* */ > > thanks :) No problem, I will change it. > > Shall I send an updated patch as reply to this thread, > or shall I wait until I have addressed the other comments and send a PATCH v2 series then, containing all the patches > again? As you prefer, patch is orthogonal, I can apply it independently from the other ones. Best regards, Stefano > > Kind regards, > Michael >
diff --git a/core/artifacts_versions.c b/core/artifacts_versions.c index 6074c33..63350d2 100644 --- a/core/artifacts_versions.c +++ b/core/artifacts_versions.c @@ -131,21 +131,12 @@ static int versions_settings(void *setting, void *data) void get_sw_versions(swupdate_cfg_handle *handle, struct swupdate_cfg *sw) { - int ret = -EINVAL; - - /* - * Try to read versions from configuration file - * If not found, fall back to a legacy file - * in the format "<image name> <version>" - */ - if (handle != NULL) - ret = swupdate_cfg_read_module_settings(handle, "versions", - versions_settings, - sw); - - if (ret) - ret = read_sw_version_file(sw); - + // Try to read versions from configuration file + if (handle != NULL && swupdate_cfg_read_module_settings(handle, "versions", versions_settings, sw) == 0) { + return; + } + // If not found, fall back to a legacy file in the format "<image name> <version>" + read_sw_version_file(sw); } #else