[PATCH] firmware-utils: fix Wparentheses parnings
Rosen Penev
rosenp at gmail.com
Sun Feb 27 23:43:50 PST 2022
On Sun, Feb 27, 2022 at 11:42 PM Rosen Penev <rosenp at gmail.com> wrote:
>
> () is normally used for comparison and (()) for assignment and
> comparison. Normalize both situations.
>
> Signed-off-by: Rosen Penev <rosenp at gmail.com>
> ---
> src/mkcasfw.c | 2 +-
> src/mkcsysimg.c | 2 +-
> src/mkmylofw.c | 2 +-
> src/mkzynfw.c | 2 +-
> src/srec2bin.c | 2 +-
> 5 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/mkcasfw.c b/src/mkcasfw.c
> index 09d6ee8..e4ce90c 100644
> --- a/src/mkcasfw.c
> +++ b/src/mkcasfw.c
> @@ -378,7 +378,7 @@ parse_arg(char *arg, char *buf, char *argv[])
>
> memset(argv, 0, MAX_ARG_COUNT * sizeof(void *));
>
> - if ((arg == NULL)) {
> + if (arg == NULL) {
> /* no arguments */
> return 0;
> }
> diff --git a/src/mkcsysimg.c b/src/mkcsysimg.c
> index cbe06bb..b78e5fb 100644
> --- a/src/mkcsysimg.c
> +++ b/src/mkcsysimg.c
> @@ -328,7 +328,7 @@ parse_arg(char *arg, char *buf, char *argv[])
>
> memset(argv, 0, MAX_ARG_COUNT * sizeof(void *));
>
> - if ((arg == NULL)) {
> + if (arg == NULL) {
> /* no arguments */
> return 0;
> }
> diff --git a/src/mkmylofw.c b/src/mkmylofw.c
> index fd79f1c..74e265d 100644
> --- a/src/mkmylofw.c
> +++ b/src/mkmylofw.c
> @@ -724,7 +724,7 @@ parse_arg(char *arg, char *buf, char *argv[])
> char **ap = &buf;
> int i;
>
> - if ((arg == NULL)) {
> + if (arg == NULL) {
> /* invalid argument string */
> return -1;
> }
> diff --git a/src/mkzynfw.c b/src/mkzynfw.c
> index 19909b1..07ec5c6 100644
> --- a/src/mkzynfw.c
> +++ b/src/mkzynfw.c
> @@ -368,7 +368,7 @@ parse_arg(char *arg, char *buf, char *argv[])
>
> memset(argv, 0, MAX_ARG_COUNT * sizeof(void *));
>
> - if ((arg == NULL)) {
> + if (arg == NULL) {
> /* no arguments */
> return 0;
> }
> diff --git a/src/srec2bin.c b/src/srec2bin.c
> index ad4222d..0758664 100644
> --- a/src/srec2bin.c
> +++ b/src/srec2bin.c
> @@ -405,7 +405,7 @@ int srecLine(char *pSrecLine)
> break;
> case '5': if (count<3) return(SRLerrorout("Invalid Srecord count field",scp));
> itmp=gh(pSrecLine,4); pSrecLine+=4; count-=2;
> - if (itmp|=s1s2s3_total) return(SRLerrorout("Incorrect number of S3 Record processed",scp));
> + if ((itmp|=s1s2s3_total)) return(SRLerrorout("Incorrect number of S3 Record processed",scp));
I can't tell if this is a bug in the code or intentional.
> break;
> case '6': return(SRLerrorout("Invalid Srecord type",scp));
> break;
> --
> 2.35.1
>
More information about the openwrt-devel
mailing list