Skip to content

Commit d3f6214

Browse files
committed
drivers/apc_modbus.c: apc_modbus_outlet_cmd_suffixes[]: avoid literal 0 as initializer for enum-typed field [networkupstools#3395]
Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
1 parent 0a13208 commit d3f6214

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/apc_modbus.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,7 @@ static apc_modbus_outlet_group_info_t apc_modbus_outlet_group_info[] = {
12901290

12911291
/* Outlet command types for dynamic handling */
12921292
typedef enum {
1293+
APC_OC_NULL = 0,
12931294
APC_OC_LOAD_OFF,
12941295
APC_OC_LOAD_ON,
12951296
APC_OC_LOAD_CYCLE,
@@ -1316,7 +1317,7 @@ static apc_modbus_outlet_cmd_suffix_t apc_modbus_outlet_cmd_suffixes[] = {
13161317
{ "shutdown.stayoff", APC_OC_SHUTDOWN_STAYOFF },
13171318
{ "shutdown.reboot", APC_OC_SHUTDOWN_REBOOT },
13181319
{ "shutdown.reboot.graceful", APC_OC_SHUTDOWN_REBOOT_GRACEFUL },
1319-
{ NULL, 0 }
1320+
{ NULL, APC_OC_NULL }
13201321
};
13211322

13221323
/* Build outlet command value from command type and target bits */
@@ -1367,6 +1368,7 @@ static uint64_t _apc_modbus_build_outlet_cmd(apc_modbus_outlet_cmd_type_t type,
13671368
# pragma clang diagnostic ignored "-Wunreachable-code"
13681369
# pragma clang diagnostic ignored "-Wcovered-switch-default"
13691370
#endif
1371+
case APC_OC_NULL:
13701372
default:
13711373
/* Must not occur. */
13721374
break;

0 commit comments

Comments
 (0)