All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/9] ACPICA: ACPICA: fix -Wfallthrough
  2021-01-15 18:48 [PATCH 0/9] ACPICA release 20201217 and 20210105 Erik Kaneda
@ 2021-01-15 18:48 ` Erik Kaneda
  0 siblings, 0 replies; 2+ messages in thread
From: Erik Kaneda @ 2021-01-15 18:48 UTC (permalink / raw
  To: Rafael J . Wysocki, ACPI Devel Maling List
  Cc: Nick Desaulniers, Robert Moore, Erik Kaneda

From: Nick Desaulniers <ndesaulniers@google.com>

ACPICA commit 4b9135f5774caa796ddf826448811e8e7f08ef2f

GCC 7.1 gained -Wimplicit-fallthrough to warn on implicit fallthrough,
as well as __attribute__((__fallthrough__)) and comments to explicitly
denote that cases of fallthrough were intentional. Clang also supports
this warning and statement attribute, but not the comment form.

Robert Moore provides additional context about the lint comments being
removed. They were for "an old version of PC-Lint, which we don't use
anymore." Drop those.

This will help us enable -Wimplicit-fallthrough throughout the Linux
kernel.

Suggested-by: Robert Moore <robert.moore@intel.com>

Link: https://github.com/acpica/acpica/commit/4b9135f5
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Erik Kaneda <erik.kaneda@intel.com>
---
 drivers/acpi/acpica/dscontrol.c |  2 +-
 drivers/acpi/acpica/dswexec.c   |  3 +--
 drivers/acpi/acpica/dswload.c   |  2 +-
 drivers/acpi/acpica/dswload2.c  |  2 +-
 drivers/acpi/acpica/exfldio.c   |  2 +-
 drivers/acpi/acpica/exresop.c   |  4 ++--
 drivers/acpi/acpica/exstore.c   |  4 ++--
 drivers/acpi/acpica/hwgpe.c     |  2 +-
 drivers/acpi/acpica/utdelete.c  |  2 +-
 include/acpi/actypes.h          |  5 +++++
 include/acpi/platform/acgcc.h   | 15 +++++++++++++++
 11 files changed, 31 insertions(+), 12 deletions(-)

diff --git a/drivers/acpi/acpica/dscontrol.c b/drivers/acpi/acpica/dscontrol.c
index 4b5b6e859f62..b58ffc7acdb9 100644
--- a/drivers/acpi/acpica/dscontrol.c
+++ b/drivers/acpi/acpica/dscontrol.c
@@ -62,7 +62,7 @@ acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
 			}
 		}
 
-		/*lint -fallthrough */
+		ACPI_FALLTHROUGH;
 
 	case AML_IF_OP:
 		/*
diff --git a/drivers/acpi/acpica/dswexec.c b/drivers/acpi/acpica/dswexec.c
index 1d4f8c81028c..4a9799246fae 100644
--- a/drivers/acpi/acpica/dswexec.c
+++ b/drivers/acpi/acpica/dswexec.c
@@ -598,8 +598,7 @@ acpi_status acpi_ds_exec_end_op(struct acpi_walk_state *walk_state)
 					break;
 				}
 
-				/* Fall through */
-				/*lint -fallthrough */
+				ACPI_FALLTHROUGH;
 
 			case AML_INT_EVAL_SUBTREE_OP:
 
diff --git a/drivers/acpi/acpica/dswload.c b/drivers/acpi/acpica/dswload.c
index 27069325b6de..dd97c86f8e41 100644
--- a/drivers/acpi/acpica/dswload.c
+++ b/drivers/acpi/acpica/dswload.c
@@ -224,7 +224,7 @@ acpi_ds_load1_begin_op(struct acpi_walk_state *walk_state,
 				break;
 			}
 
-			/*lint -fallthrough */
+			ACPI_FALLTHROUGH;
 
 		default:
 
diff --git a/drivers/acpi/acpica/dswload2.c b/drivers/acpi/acpica/dswload2.c
index edadbe146506..d9a3dfca7555 100644
--- a/drivers/acpi/acpica/dswload2.c
+++ b/drivers/acpi/acpica/dswload2.c
@@ -214,7 +214,7 @@ acpi_ds_load2_begin_op(struct acpi_walk_state *walk_state,
 				break;
 			}
 
-			/*lint -fallthrough */
+			ACPI_FALLTHROUGH;
 
 		default:
 
diff --git a/drivers/acpi/acpica/exfldio.c b/drivers/acpi/acpica/exfldio.c
index ade35ff1c7ba..cde24e0fa6a8 100644
--- a/drivers/acpi/acpica/exfldio.c
+++ b/drivers/acpi/acpica/exfldio.c
@@ -434,7 +434,7 @@ acpi_ex_field_datum_io(union acpi_operand_object *obj_desc,
 		 * region_field case and write the datum to the Operation Region
 		 */
 
-		/*lint -fallthrough */
+		ACPI_FALLTHROUGH;
 
 	case ACPI_TYPE_LOCAL_REGION_FIELD:
 		/*
diff --git a/drivers/acpi/acpica/exresop.c b/drivers/acpi/acpica/exresop.c
index 4d1b22971d58..4a0f8b8bfe62 100644
--- a/drivers/acpi/acpica/exresop.c
+++ b/drivers/acpi/acpica/exresop.c
@@ -198,7 +198,7 @@ acpi_ex_resolve_operands(u16 opcode,
 
 					target_op = AML_DEBUG_OP;
 
-					/*lint -fallthrough */
+					ACPI_FALLTHROUGH;
 
 				case ACPI_REFCLASS_ARG:
 				case ACPI_REFCLASS_LOCAL:
@@ -264,7 +264,7 @@ acpi_ex_resolve_operands(u16 opcode,
 			 * Else not a string - fall through to the normal Reference
 			 * case below
 			 */
-			/*lint -fallthrough */
+			ACPI_FALLTHROUGH;
 
 		case ARGI_REFERENCE:	/* References: */
 		case ARGI_INTEGER_REF:
diff --git a/drivers/acpi/acpica/exstore.c b/drivers/acpi/acpica/exstore.c
index 3adc0a29d890..8fe33051275d 100644
--- a/drivers/acpi/acpica/exstore.c
+++ b/drivers/acpi/acpica/exstore.c
@@ -96,7 +96,7 @@ acpi_ex_store(union acpi_operand_object *source_desc,
 			return_ACPI_STATUS(AE_OK);
 		}
 
-		/*lint -fallthrough */
+		ACPI_FALLTHROUGH;
 
 	default:
 
@@ -422,7 +422,7 @@ acpi_ex_store_object_to_node(union acpi_operand_object *source_desc,
 				break;
 			}
 
-			/* Fallthrough */
+			ACPI_FALLTHROUGH;
 
 		case ACPI_TYPE_DEVICE:
 		case ACPI_TYPE_EVENT:
diff --git a/drivers/acpi/acpica/hwgpe.c b/drivers/acpi/acpica/hwgpe.c
index b13a4ed5bc63..0c84300e915c 100644
--- a/drivers/acpi/acpica/hwgpe.c
+++ b/drivers/acpi/acpica/hwgpe.c
@@ -167,7 +167,7 @@ acpi_hw_low_set_gpe(struct acpi_gpe_event_info *gpe_event_info, u32 action)
 			return (AE_BAD_PARAMETER);
 		}
 
-		/*lint -fallthrough */
+		ACPI_FALLTHROUGH;
 
 	case ACPI_GPE_ENABLE:
 
diff --git a/drivers/acpi/acpica/utdelete.c b/drivers/acpi/acpica/utdelete.c
index 4c0d4e434196..624a26794d55 100644
--- a/drivers/acpi/acpica/utdelete.c
+++ b/drivers/acpi/acpica/utdelete.c
@@ -112,7 +112,7 @@ static void acpi_ut_delete_internal_obj(union acpi_operand_object *object)
 						       gpe_block);
 		}
 
-		/*lint -fallthrough */
+		ACPI_FALLTHROUGH;
 
 	case ACPI_TYPE_PROCESSOR:
 	case ACPI_TYPE_THERMAL:
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
index 647cb11d0a0a..9082628ee3ed 100644
--- a/include/acpi/actypes.h
+++ b/include/acpi/actypes.h
@@ -1286,4 +1286,9 @@ typedef enum {
 
 #define ACPI_OPT_END                    -1
 
+/* Definitions for explicit fallthrough */
+
+#ifndef ACPI_FALLTHROUGH
+#endif
+
 #endif				/* __ACTYPES_H__ */
diff --git a/include/acpi/platform/acgcc.h b/include/acpi/platform/acgcc.h
index 7d63d03cf507..91f7a02c798a 100644
--- a/include/acpi/platform/acgcc.h
+++ b/include/acpi/platform/acgcc.h
@@ -54,4 +54,19 @@ typedef __builtin_va_list va_list;
 
 #define ACPI_USE_NATIVE_MATH64
 
+/* GCC did not support __has_attribute until 5.1. */
+
+#ifndef __has_attribute
+#define __has_attribute(x) 0
+#endif
+
+/*
+ * Explictly mark intentional explicit fallthrough to silence
+ * -Wimplicit-fallthrough in GCC 7.1+.
+ */
+
+#if __has_attribute(__fallthrough__)
+#define ACPI_FALLTHROUGH __attribute__((__fallthrough__))
+#endif
+
 #endif				/* __ACGCC_H__ */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/9] ACPICA: ACPICA: fix -Wfallthrough
@ 2021-01-16  0:00 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-01-16  0:00 UTC (permalink / raw
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 10198 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20210115184826.2250-4-erik.kaneda@intel.com>
References: <20210115184826.2250-4-erik.kaneda@intel.com>
TO: Erik Kaneda <erik.kaneda@intel.com>
TO: "Rafael J . Wysocki" <rafael@kernel.org>
TO: ACPI Devel Maling List <linux-acpi@vger.kernel.org>
CC: Nick Desaulniers <ndesaulniers@google.com>
CC: Robert Moore <robert.moore@intel.com>
CC: Erik Kaneda <erik.kaneda@intel.com>

Hi Erik,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v5.11-rc3 next-20210115]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Erik-Kaneda/ACPICA-release-20201217-and-20210105/20210116-032653
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: i386-randconfig-m021-20210115 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/acpi/acpica/dscontrol.c:65 acpi_ds_exec_begin_control_op() warn: statement has no effect 3
drivers/acpi/acpica/dswload.c:227 acpi_ds_load1_begin_op() warn: statement has no effect 3
drivers/acpi/acpica/dswexec.c:601 acpi_ds_exec_end_op() warn: statement has no effect 3
drivers/acpi/acpica/dswload2.c:217 acpi_ds_load2_begin_op() warn: statement has no effect 3
drivers/acpi/acpica/exfldio.c:437 acpi_ex_field_datum_io() warn: statement has no effect 3
drivers/acpi/acpica/exresop.c:201 acpi_ex_resolve_operands() warn: statement has no effect 3
drivers/acpi/acpica/exstore.c:99 acpi_ex_store() warn: statement has no effect 3
drivers/acpi/acpica/exstore.c:425 acpi_ex_store_object_to_node() warn: statement has no effect 3
drivers/acpi/acpica/hwgpe.c:170 acpi_hw_low_set_gpe() warn: statement has no effect 3
drivers/acpi/acpica/utdelete.c:115 acpi_ut_delete_internal_obj() warn: statement has no effect 3

Old smatch warnings:
drivers/acpi/acpica/exresop.c:267 acpi_ex_resolve_operands() warn: statement has no effect 3

vim +65 drivers/acpi/acpica/dscontrol.c

9ad19ac456a5f097 Bob Moore        2011-02-14   20  
9ad19ac456a5f097 Bob Moore        2011-02-14   21  /*******************************************************************************
9ad19ac456a5f097 Bob Moore        2011-02-14   22   *
9ad19ac456a5f097 Bob Moore        2011-02-14   23   * FUNCTION:    acpi_ds_exec_begin_control_op
9ad19ac456a5f097 Bob Moore        2011-02-14   24   *
9ad19ac456a5f097 Bob Moore        2011-02-14   25   * PARAMETERS:  walk_list       - The list that owns the walk stack
ba494beeaa69bc0f Bob Moore        2012-07-12   26   *              op              - The control Op
9ad19ac456a5f097 Bob Moore        2011-02-14   27   *
9ad19ac456a5f097 Bob Moore        2011-02-14   28   * RETURN:      Status
9ad19ac456a5f097 Bob Moore        2011-02-14   29   *
9ad19ac456a5f097 Bob Moore        2011-02-14   30   * DESCRIPTION: Handles all control ops encountered during control method
9ad19ac456a5f097 Bob Moore        2011-02-14   31   *              execution.
9ad19ac456a5f097 Bob Moore        2011-02-14   32   *
9ad19ac456a5f097 Bob Moore        2011-02-14   33   ******************************************************************************/
9ad19ac456a5f097 Bob Moore        2011-02-14   34  acpi_status
9ad19ac456a5f097 Bob Moore        2011-02-14   35  acpi_ds_exec_begin_control_op(struct acpi_walk_state *walk_state,
9ad19ac456a5f097 Bob Moore        2011-02-14   36  			      union acpi_parse_object *op)
9ad19ac456a5f097 Bob Moore        2011-02-14   37  {
9ad19ac456a5f097 Bob Moore        2011-02-14   38  	acpi_status status = AE_OK;
9ad19ac456a5f097 Bob Moore        2011-02-14   39  	union acpi_generic_state *control_state;
9ad19ac456a5f097 Bob Moore        2011-02-14   40  
9ad19ac456a5f097 Bob Moore        2011-02-14   41  	ACPI_FUNCTION_NAME(ds_exec_begin_control_op);
9ad19ac456a5f097 Bob Moore        2011-02-14   42  
9ad19ac456a5f097 Bob Moore        2011-02-14   43  	ACPI_DEBUG_PRINT((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n",
9ad19ac456a5f097 Bob Moore        2011-02-14   44  			  op, op->common.aml_opcode, walk_state));
9ad19ac456a5f097 Bob Moore        2011-02-14   45  
9ad19ac456a5f097 Bob Moore        2011-02-14   46  	switch (op->common.aml_opcode) {
9ad19ac456a5f097 Bob Moore        2011-02-14   47  	case AML_WHILE_OP:
9ad19ac456a5f097 Bob Moore        2011-02-14   48  		/*
9ad19ac456a5f097 Bob Moore        2011-02-14   49  		 * If this is an additional iteration of a while loop, continue.
9ad19ac456a5f097 Bob Moore        2011-02-14   50  		 * There is no need to allocate a new control state.
9ad19ac456a5f097 Bob Moore        2011-02-14   51  		 */
9ad19ac456a5f097 Bob Moore        2011-02-14   52  		if (walk_state->control_state) {
9ad19ac456a5f097 Bob Moore        2011-02-14   53  			if (walk_state->control_state->control.
9ad19ac456a5f097 Bob Moore        2011-02-14   54  			    aml_predicate_start ==
9ad19ac456a5f097 Bob Moore        2011-02-14   55  			    (walk_state->parser_state.aml - 1)) {
9ad19ac456a5f097 Bob Moore        2011-02-14   56  
9ad19ac456a5f097 Bob Moore        2011-02-14   57  				/* Reset the state to start-of-loop */
9ad19ac456a5f097 Bob Moore        2011-02-14   58  
9ad19ac456a5f097 Bob Moore        2011-02-14   59  				walk_state->control_state->common.state =
9ad19ac456a5f097 Bob Moore        2011-02-14   60  				    ACPI_CONTROL_CONDITIONAL_EXECUTING;
9ad19ac456a5f097 Bob Moore        2011-02-14   61  				break;
9ad19ac456a5f097 Bob Moore        2011-02-14   62  			}
9ad19ac456a5f097 Bob Moore        2011-02-14   63  		}
9ad19ac456a5f097 Bob Moore        2011-02-14   64  
92eb687d90825d7b Nick Desaulniers 2021-01-15  @65  		ACPI_FALLTHROUGH;
9ad19ac456a5f097 Bob Moore        2011-02-14   66  
9ad19ac456a5f097 Bob Moore        2011-02-14   67  	case AML_IF_OP:
9ad19ac456a5f097 Bob Moore        2011-02-14   68  		/*
9ad19ac456a5f097 Bob Moore        2011-02-14   69  		 * IF/WHILE: Create a new control state to manage these
9ad19ac456a5f097 Bob Moore        2011-02-14   70  		 * constructs. We need to manage these as a stack, in order
9ad19ac456a5f097 Bob Moore        2011-02-14   71  		 * to handle nesting.
9ad19ac456a5f097 Bob Moore        2011-02-14   72  		 */
9ad19ac456a5f097 Bob Moore        2011-02-14   73  		control_state = acpi_ut_create_control_state();
9ad19ac456a5f097 Bob Moore        2011-02-14   74  		if (!control_state) {
9ad19ac456a5f097 Bob Moore        2011-02-14   75  			status = AE_NO_MEMORY;
9ad19ac456a5f097 Bob Moore        2011-02-14   76  			break;
9ad19ac456a5f097 Bob Moore        2011-02-14   77  		}
9ad19ac456a5f097 Bob Moore        2011-02-14   78  		/*
9ad19ac456a5f097 Bob Moore        2011-02-14   79  		 * Save a pointer to the predicate for multiple executions
9ad19ac456a5f097 Bob Moore        2011-02-14   80  		 * of a loop
9ad19ac456a5f097 Bob Moore        2011-02-14   81  		 */
9ad19ac456a5f097 Bob Moore        2011-02-14   82  		control_state->control.aml_predicate_start =
9ad19ac456a5f097 Bob Moore        2011-02-14   83  		    walk_state->parser_state.aml - 1;
9ad19ac456a5f097 Bob Moore        2011-02-14   84  		control_state->control.package_end =
9ad19ac456a5f097 Bob Moore        2011-02-14   85  		    walk_state->parser_state.pkg_end;
9ad19ac456a5f097 Bob Moore        2011-02-14   86  		control_state->control.opcode = op->common.aml_opcode;
164a08cee1358e36 Lv Zheng         2017-11-17   87  		control_state->control.loop_timeout = acpi_os_get_timer() +
197aba2090e357af Bob Moore        2019-10-25   88  		    ((u64)acpi_gbl_max_loop_iterations * ACPI_100NSEC_PER_SEC);
9ad19ac456a5f097 Bob Moore        2011-02-14   89  
9ad19ac456a5f097 Bob Moore        2011-02-14   90  		/* Push the control state on this walk's control stack */
9ad19ac456a5f097 Bob Moore        2011-02-14   91  
9ad19ac456a5f097 Bob Moore        2011-02-14   92  		acpi_ut_push_generic_state(&walk_state->control_state,
9ad19ac456a5f097 Bob Moore        2011-02-14   93  					   control_state);
9ad19ac456a5f097 Bob Moore        2011-02-14   94  		break;
9ad19ac456a5f097 Bob Moore        2011-02-14   95  
9ad19ac456a5f097 Bob Moore        2011-02-14   96  	case AML_ELSE_OP:
9ad19ac456a5f097 Bob Moore        2011-02-14   97  
9ad19ac456a5f097 Bob Moore        2011-02-14   98  		/* Predicate is in the state object */
9ad19ac456a5f097 Bob Moore        2011-02-14   99  		/* If predicate is true, the IF was executed, ignore ELSE part */
9ad19ac456a5f097 Bob Moore        2011-02-14  100  
9ad19ac456a5f097 Bob Moore        2011-02-14  101  		if (walk_state->last_predicate) {
9ad19ac456a5f097 Bob Moore        2011-02-14  102  			status = AE_CTRL_TRUE;
9ad19ac456a5f097 Bob Moore        2011-02-14  103  		}
9ad19ac456a5f097 Bob Moore        2011-02-14  104  
9ad19ac456a5f097 Bob Moore        2011-02-14  105  		break;
9ad19ac456a5f097 Bob Moore        2011-02-14  106  
9ad19ac456a5f097 Bob Moore        2011-02-14  107  	case AML_RETURN_OP:
9ad19ac456a5f097 Bob Moore        2011-02-14  108  
9ad19ac456a5f097 Bob Moore        2011-02-14  109  		break;
9ad19ac456a5f097 Bob Moore        2011-02-14  110  
9ad19ac456a5f097 Bob Moore        2011-02-14  111  	default:
1d1ea1b723d9f239 Chao Guan        2013-06-08  112  
9ad19ac456a5f097 Bob Moore        2011-02-14  113  		break;
9ad19ac456a5f097 Bob Moore        2011-02-14  114  	}
9ad19ac456a5f097 Bob Moore        2011-02-14  115  
9ad19ac456a5f097 Bob Moore        2011-02-14  116  	return (status);
9ad19ac456a5f097 Bob Moore        2011-02-14  117  }
9ad19ac456a5f097 Bob Moore        2011-02-14  118  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 32748 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-16  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-16  0:00 [PATCH 3/9] ACPICA: ACPICA: fix -Wfallthrough kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-01-15 18:48 [PATCH 0/9] ACPICA release 20201217 and 20210105 Erik Kaneda
2021-01-15 18:48 ` [PATCH 3/9] ACPICA: ACPICA: fix -Wfallthrough Erik Kaneda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.