]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
scsi: aic7xxx: Fix compiler warnings triggered by user space code
authorBart Van Assche <bvanassche@acm.org>
Thu, 2 Apr 2026 15:33:33 +0000 (08:33 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 3 Apr 2026 01:18:12 +0000 (21:18 -0400)
Fix the following compiler warnings:

aicasm_gram.y:1107:24: warning: comparison of different enumeration types
      ('scope_type' and 'enum yytokentype') [-Wenum-compare]
 1107 |                  || last_scope->type == T_ELSE) {
      |                     ~~~~~~~~~~~~~~~~ ^  ~~~~~~
aicasm_scan.l:392:14: warning: using the result of an assignment as a condition
      without parentheses [-Wparentheses]
  392 |                                 while (c = *yptr++) {
      |                                        ~~^~~~~~~~~
aicasm_macro_scan.l:153:1: warning: non-void function does not return a value
      [-Wreturn-type]
  153 | }
      | ^

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260402153341.2909184-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/aic7xxx/aicasm/aicasm.h
drivers/scsi/aic7xxx/aicasm/aicasm_gram.y
drivers/scsi/aic7xxx/aicasm/aicasm_scan.l

index 716a2aefc925f4c2330a5028098bf7789af170d8..f290b50c64754a916580d16ed96f8d4935cc490a 100644 (file)
@@ -82,7 +82,7 @@ extern int   src_mode;
 extern int   dst_mode;
 struct symbol;
 
-void stop(const char *errstring, int err_code);
+void __attribute__((noreturn)) stop(const char *errstring, int err_code);
 void include_file(char *file_name, include_type type);
 void expand_macro(struct symbol *macro_symbol);
 struct instruction *seq_alloc(void);
index b1c9ce477cbd0e6878054f247bf86c087866c35a..f6dbb9855daad599a8e04f918eea963e113035aa 100644 (file)
@@ -1104,7 +1104,7 @@ conditional:
                last_scope = TAILQ_LAST(&scope_context->inner_scope,
                                        scope_tailq);
                if (last_scope == NULL
-                || last_scope->type == T_ELSE) {
+                || last_scope->type == (int)T_ELSE) {
 
                        stop("'else if' without leading 'if'", EX_DATAERR);
                        /* NOTREACHED */
index fc7e6c58148dfc940a841020a04d63c029348b44..c0d92cf5f9b5a070b09a0d7de4e693ba5e34e017 100644 (file)
@@ -389,7 +389,7 @@ nop                 { return T_NOP; }
                                char c;
 
                                yptr = yytext;
-                               while (c = *yptr++) {
+                               while ((c = *yptr++)) {
                                        /*
                                         * Strip carriage returns.
                                         */