Skip to content

Commit 395a187

Browse files
committed
[sw/device] Fix strict prototype violations
I generated the changes in this commit by running this command: ./bazelisk.sh build -k \ --config=riscv32 --config=clang_tidy //sw/device/...
1 parent 17f6a4a commit 395a187

35 files changed

+50
-50
lines changed

sw/device/examples/sram_program/sram_program.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ enum {
2424
TOP_EARLGREY_SRAM_CTRL_MAIN_RAM_SIZE_BYTES,
2525
};
2626

27-
void sram_main() {
27+
void sram_main(void) {
2828
if (kDeviceType != kDeviceSimDV) {
2929
// Configure the pinmux.
3030
CHECK_DIF_OK(dif_pinmux_init(
@@ -62,4 +62,4 @@ void sram_main() {
6262
// Reference functions that the debugger may wish to call. This prevents the
6363
// compiler from dropping them as unused functions and has the side benefit of
6464
// preventing their includes from appearing unused.
65-
void debugger_support_functions() { (void)icache_invalidate; }
65+
void debugger_support_functions(void) { (void)icache_invalidate; }

sw/device/lib/testing/alert_handler_testutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,6 @@ status_t alert_handler_testutils_get_cycles_from_us(uint64_t microseconds,
152152
return OK_STATUS();
153153
}
154154

155-
uint32_t alert_handler_testutils_cycle_rescaling_factor() {
155+
uint32_t alert_handler_testutils_cycle_rescaling_factor(void) {
156156
return kDeviceType == kDeviceSimDV ? 1 : 10;
157157
}

sw/device/lib/testing/clkmgr_testutils.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static uint32_t cast_safely(uint64_t val) {
5050
return (uint32_t)val;
5151
}
5252

53-
void initialize_expected_counts() {
53+
void initialize_expected_counts(void) {
5454
// The expected counts depend on the device, per sw/device/lib/arch/device.h.
5555
// Notice the ratios are small enough to fit a uint32_t, even if the Hz number
5656
// is in uint64_t.

sw/device/lib/testing/profile.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include "sw/device/lib/runtime/ibex.h"
88
#include "sw/device/lib/testing/test_framework/check.h"
99

10-
uint64_t profile_start() { return ibex_mcycle_read(); }
10+
uint64_t profile_start(void) { return ibex_mcycle_read(); }
1111

1212
uint32_t profile_end(uint64_t t_start) {
1313
uint64_t t_end = ibex_mcycle_read();

sw/device/lib/testing/rstmgr_testutils.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ status_t rstmgr_testutils_post_reset(
9696
return OK_STATUS();
9797
}
9898

99-
dif_rstmgr_reset_info_bitfield_t rstmgr_testutils_reason_get() {
99+
dif_rstmgr_reset_info_bitfield_t rstmgr_testutils_reason_get(void) {
100100
return retention_sram_get()->reset_reasons;
101101
}
102102

103-
void rstmgr_testutils_reason_clear() {
103+
void rstmgr_testutils_reason_clear(void) {
104104
retention_sram_get()->reset_reasons = 0;
105105
}

sw/device/lib/testing/test_framework/ottf_console.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ static dif_uart_t ottf_console_uart;
5151
static volatile ottf_console_flow_control_t flow_control_state;
5252
static volatile uint32_t flow_control_irqs;
5353

54-
void *ottf_console_get() {
54+
void *ottf_console_get(void) {
5555
switch (kOttfTestConfig.console.type) {
5656
case kOttfConsoleSpiDevice:
5757
return &ottf_console_spi_device;
@@ -123,7 +123,7 @@ void ottf_console_init(void) {
123123
}
124124
}
125125

126-
static uint32_t get_flow_control_watermark_plic_id() {
126+
static uint32_t get_flow_control_watermark_plic_id(void) {
127127
switch (kOttfTestConfig.console.base_addr) {
128128
#if !OT_IS_ENGLISH_BREAKFAST
129129
case TOP_EARLGREY_UART1_BASE_ADDR:

sw/device/sca/ecc256_sign_serial.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static void p256_ecdsa_sign(const uint32_t *msg, const uint32_t *private_key_d,
231231
* Triggers OTBN_P256_sign operation.
232232
*
233233
*/
234-
static void ecc256_ecdsa() {
234+
static void ecc256_ecdsa(void) {
235235
LOG_INFO("SSECDSA starting...");
236236
SS_CHECK_STATUS_OK(otbn_load_app(kOtbnAppP256Ecdsa));
237237
LOG_INFO("otbn_status: 0x%08x", abs_mmio_read32(TOP_EARLGREY_OTBN_BASE_ADDR +

sw/device/sca/ecc384_serial.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ static void setup_data_pointer(const otbn_addr_t dptr,
152152
* This function makes the data pointers refer to the pre-allocated DMEM
153153
* regions to store the actual values.
154154
*/
155-
static void setup_data_pointers() {
155+
static void setup_data_pointers(void) {
156156
setup_data_pointer(kOtbnVarDptrMsg, kOtbnVarMsg);
157157
setup_data_pointer(kOtbnVarDptrR, kOtbnVarR);
158158
setup_data_pointer(kOtbnVarDptrS, kOtbnVarS);

sw/device/silicon_creator/lib/sigverify/sphincsplus/test/fors_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static rom_error_t pk_from_sig_test(void) {
5050
return kErrorOk;
5151
}
5252

53-
bool test_main() {
53+
bool test_main(void) {
5454
status_t result = OK_STATUS();
5555
LOG_INFO("Starting FORS test...");
5656

sw/device/silicon_creator/lib/sigverify/sphincsplus/test/verify_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static rom_error_t spx_verify_negative_test(void) {
9797
return kErrorOk;
9898
}
9999

100-
bool test_main() {
100+
bool test_main(void) {
101101
status_t result = OK_STATUS();
102102

103103
CHECK(kNumNegativeTests <= kSpxVerifyNumTests,

sw/device/silicon_creator/lib/sigverify/sphincsplus/test/wots_test.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static const uint32_t kExpectedPk[kSpxWotsPkWords] = {
6464
0x460bec28, 0x3724f477, 0x46f9003f, 0x6357d6ec, 0x7a39121d, 0x511b498f,
6565
0x2bca40d1, 0x24b829a1};
6666

67-
static rom_error_t pk_from_sig_test() {
67+
static rom_error_t pk_from_sig_test(void) {
6868
// Initialize the KMAC block.
6969
RETURN_IF_ERROR(spx_hash_initialize(&kTestCtx));
7070

@@ -79,7 +79,7 @@ static rom_error_t pk_from_sig_test() {
7979
return kErrorOk;
8080
}
8181

82-
bool test_main() {
82+
bool test_main(void) {
8383
status_t result = OK_STATUS();
8484
LOG_INFO("Starting WOTS test...");
8585

sw/device/silicon_creator/manuf/lib/sram_exec_test.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static_assert(ARRAYSIZE(kTestDeviceID) % sizeof(uint32_t) == 0,
2727
static_assert(ARRAYSIZE(kTestDeviceID) <= 32,
2828
"kTestDeviceID must be less than 32 bytes");
2929

30-
static status_t log_device_id() {
30+
static status_t log_device_id(void) {
3131
// Read the Device_ID from OTP (except all zeroes).
3232
uint32_t otp_device_id;
3333
for (int i = 0; i < kNumDeviceId; i++) {
@@ -39,7 +39,7 @@ static status_t log_device_id() {
3939
return OK_STATUS();
4040
}
4141

42-
status_t write_otp() {
42+
status_t write_otp(void) {
4343
// Configure the pinmux.
4444
TRY(dif_pinmux_init(mmio_region_from_addr(TOP_EARLGREY_PINMUX_AON_BASE_ADDR),
4545
&pinmux));
@@ -86,7 +86,7 @@ status_t write_otp() {
8686
return OK_STATUS();
8787
}
8888

89-
void sram_main() {
89+
void sram_main(void) {
9090
status_t res = write_otp();
9191
LOG_INFO("result: %x", res);
9292
test_status_set(kTestStatusPassed);

sw/device/silicon_creator/rom/e2e/rom_e2e_c_init_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ static void fault(void) {
7777
* and then reading back, because the pad attribute registers have
7878
* write-any-read-legal behavior.
7979
*/
80-
static uint32_t pad_attr_mask_get() {
80+
static uint32_t pad_attr_mask_get(void) {
8181
CHECK_EQ(kDeviceType, kDeviceFpgaCw310,
8282
"This test is only supported for CW310");
8383

sw/device/tests/alert_handler_lpg_clkoff_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ void set_peripheral_clock(const test_t *peripheral,
382382
* A utility function to wait enough until the alert handler pings a peripheral
383383
* alert
384384
*/
385-
void wait_enough_for_alert_ping() {
385+
void wait_enough_for_alert_ping(void) {
386386
// wait enough
387387
if (kDeviceType == kDeviceFpgaCw310) {
388388
// NUM_ALERTS*2*margin_of_safety*(2**DW)*(1/kClockFreqPeripheralHz)

sw/device/tests/alert_handler_lpg_reset_toggle.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static void alert_handler_config_peripherals(uint32_t num_peripherals,
293293
* A utility function to wait enough until the alert handler pings a peripheral
294294
* alert
295295
*/
296-
void wait_enough_for_alert_ping() {
296+
void wait_enough_for_alert_ping(void) {
297297
// wait enough
298298
if (kDeviceType == kDeviceFpgaCw310) {
299299
// NUM_ALERTS*2*margin_of_safety*(2**DW)*(1/kClockFreqPeripheralHz)

sw/device/tests/alert_handler_lpg_sleep_mode_alerts.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static size_t test_step_cnt;
266266
* Helper function to keep the test body clean
267267
* Initializes the flash_ctrl and test counters.
268268
*/
269-
void init_test_components() {
269+
void init_test_components(void) {
270270
// Enable global and external IRQ at Ibex.
271271
irq_global_ctrl(true);
272272
irq_external_ctrl(true);

sw/device/tests/alert_handler_lpg_sleep_mode_pings.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static void init_peripherals(void) {
7979
* A utility function to wait enough until the alert handler pings a peripheral
8080
* alert
8181
*/
82-
void wait_enough_for_alert_ping() {
82+
void wait_enough_for_alert_ping(void) {
8383
// wait enough
8484
if (kDeviceType == kDeviceFpgaCw310) {
8585
// 2*margin_of_safety*(2**DW)*(1/kClockFreqPeripheralHz)
@@ -295,7 +295,7 @@ static size_t test_step_cnt;
295295
* Helper function to keep the test body clean
296296
* Initializes the flash_ctrl and test counters.
297297
*/
298-
void init_test_components() {
298+
void init_test_components(void) {
299299
// Enable global and external IRQ at Ibex.
300300
irq_global_ctrl(true);
301301
irq_external_ctrl(true);

sw/device/tests/clkmgr_off_kmac_trans_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88

99
#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
1010

11-
bool test_main() {
11+
bool test_main(void) {
1212
return execute_off_trans_test(kTopEarlgreyHintableClocksMainKmac);
1313
}

sw/device/tests/clkmgr_off_peri_test.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
OTTF_DEFINE_TEST_CONFIG();
3838

3939
typedef struct peri_context {
40-
void (*csr_access)(); // The function causing a timeout.
40+
void (*csr_access)(void); // The function causing a timeout.
4141
uint32_t address; // The address causing a timeout.
4242
} peri_context_t;
4343

@@ -62,7 +62,7 @@ static void set_hung_address(dif_clkmgr_gateable_clock_t clock,
6262
value, addr);
6363
}
6464

65-
static void uart0_csr_access() {
65+
static void uart0_csr_access(void) {
6666
dif_toggle_t state;
6767
CHECK_DIF_OK(dif_uart_irq_set_enabled(&uart0, kDifUartIrqTxWatermark,
6868
kDifToggleEnabled));
@@ -71,7 +71,7 @@ static void uart0_csr_access() {
7171
CHECK(state == kDifToggleEnabled);
7272
}
7373

74-
static void spi_host0_csr_access() {
74+
static void spi_host0_csr_access(void) {
7575
dif_toggle_t state;
7676
CHECK_DIF_OK(dif_spi_host_irq_set_enabled(&spi_host0, kDifSpiHostIrqSpiEvent,
7777
kDifToggleEnabled));
@@ -80,7 +80,7 @@ static void spi_host0_csr_access() {
8080
CHECK(state == kDifToggleEnabled);
8181
}
8282

83-
static void spi_host1_csr_access() {
83+
static void spi_host1_csr_access(void) {
8484
dif_toggle_t state;
8585
CHECK_DIF_OK(dif_spi_host_irq_set_enabled(&spi_host1, kDifSpiHostIrqSpiEvent,
8686
kDifToggleEnabled));
@@ -89,7 +89,7 @@ static void spi_host1_csr_access() {
8989
CHECK(state == kDifToggleEnabled);
9090
}
9191

92-
static void usbdev_csr_access() {
92+
static void usbdev_csr_access(void) {
9393
CHECK_DIF_OK(dif_usbdev_irq_set_enabled(&usbdev, kDifUsbdevIrqPowered,
9494
kDifToggleEnabled));
9595
dif_toggle_t state;

sw/device/tests/entropy_src_ast_rng_req_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static uint32_t read_fifo_depth(dif_entropy_src_t *entropy) {
2828
return fifo_depth;
2929
}
3030

31-
bool test_main() {
31+
bool test_main(void) {
3232
dif_entropy_src_t entropy_src;
3333
CHECK_DIF_OK(dif_entropy_src_init(
3434
mmio_region_from_addr(TOP_EARLGREY_ENTROPY_SRC_BASE_ADDR), &entropy_src));

sw/device/tests/entropy_src_edn_reqs_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ status_t execute_test(void) {
242242
* TODO: Run the test entropy src end reqs in continuous mode
243243
* (https://github.com/lowRISC/opentitan/issues/13393)
244244
*/
245-
bool test_main() {
245+
bool test_main(void) {
246246
test_initialize();
247247

248248
alert_handler_configure(&alert_handler);

sw/device/tests/hmac_enc_idle_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static status_t handle_end_of_process(dif_clkmgr_hintable_clock_t clock) {
6767
return OK_STATUS();
6868
}
6969

70-
static status_t execute_test() {
70+
static status_t execute_test(void) {
7171
// With the HMAC unit idle, write the HMAC clk hint to 0 within clkmgr to
7272
// indicate HMAC clk can be gated and verify that the HMAC clk hint status
7373
// within clkmgr reads 0 (HMAC is disabled).

sw/device/tests/otbn_randomness_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ status_t initialize_clkmgr(void) {
131131
kDifToggleEnabled);
132132
}
133133

134-
status_t execute_test() {
134+
status_t execute_test(void) {
135135
// Write the OTBN clk hint to 0 within clkmgr to indicate OTBN clk can be
136136
// gated and verify that the OTBN clk hint status within clkmgr reads 0 (OTBN
137137
// is idle).

sw/device/tests/rstmgr_alert_info_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ static node_t test_node[kTopEarlgreyAlertPeripheralLast] = {
666666
},
667667
};
668668

669-
static void init_expected_cause() {
669+
static void init_expected_cause(void) {
670670
kExpectedInfo[kRound1]
671671
.alert_info.alert_cause[kTopEarlgreyAlertIdI2c0FatalFault] = 1;
672672
kExpectedInfo[kRound1]

sw/device/tests/rv_core_ibex_rnd_test.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
OTTF_DEFINE_TEST_CONFIG();
2121

2222
// Declare two assembly functions defined in `rv_core_ibex_rnd_test.S`.
23-
extern uint32_t rv_core_ibex_rnd_read_and_immediately_check_status();
24-
extern uint32_t rv_core_ibex_check_rnd_read_possible_while_status_invalid();
23+
extern uint32_t rv_core_ibex_rnd_read_and_immediately_check_status(void);
24+
extern uint32_t rv_core_ibex_check_rnd_read_possible_while_status_invalid(void);
2525

2626
enum {
2727
kRandomDataReads = 32,

sw/device/tests/sim_dv/all_escalation_resets_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ static void execute_test(const dif_aon_timer_t *aon_timer) {
10911091
CHECK(false, "This should not be reached");
10921092
}
10931093

1094-
void check_alert_dump() {
1094+
void check_alert_dump(void) {
10951095
dif_rstmgr_alert_info_dump_segment_t dump[DIF_RSTMGR_ALERT_INFO_MAX_SIZE];
10961096
size_t seg_size;
10971097
alert_handler_testutils_info_t actual_info;

sw/device/tests/sim_dv/ast_clk_rst_inputs.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void test_event(uint32_t idx, dif_toggle_t fatal, bool set_event) {
165165
}
166166
};
167167

168-
void init_units() {
168+
void init_units(void) {
169169
CHECK_DIF_OK(dif_pwrmgr_init(
170170
mmio_region_from_addr(TOP_EARLGREY_PWRMGR_AON_BASE_ADDR), &pwrmgr));
171171
CHECK_DIF_OK(dif_rstmgr_init(
@@ -410,7 +410,7 @@ void ast_enter_sleep_states_and_check_functionality(
410410
/**
411411
* set edn auto mode
412412
*/
413-
void set_edn_auto_mode() {
413+
void set_edn_auto_mode(void) {
414414
const dif_edn_t edn0 = {
415415
.base_addr = mmio_region_from_addr(TOP_EARLGREY_EDN0_BASE_ADDR)};
416416
const dif_edn_t edn1 = {
@@ -510,7 +510,7 @@ void ottf_external_isr(void) {
510510
interrupt_serviced = true;
511511
}
512512

513-
bool test_main() {
513+
bool test_main(void) {
514514
dif_pwrmgr_domain_config_t pwrmgr_config;
515515

516516
const dif_entropy_src_config_t entropy_src_config = {

sw/device/tests/sim_dv/data_integrity_escalation_reset_test.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ static void alert_handler_config(void) {
493493
&alert_handler, kDifAlertHandlerIrqClassd, kDifToggleEnabled));
494494
}
495495

496-
static void set_aon_timers() {
496+
static void set_aon_timers(void) {
497497
uint32_t bark_cycles = 0;
498498
CHECK_STATUS_OK(aon_timer_testutils_get_aon_cycles_from_us(kWdogBarkMicros,
499499
&bark_cycles));
@@ -518,7 +518,7 @@ static void set_aon_timers() {
518518
* The aon timers should never trigger actions because escalation should take
519519
* precedence.
520520
*/
521-
static void execute_test() {
521+
static void execute_test(void) {
522522
alert_handler_config();
523523

524524
// Make sure we can receive both the watchdog and alert NMIs.

sw/device/tests/sim_dv/lc_walkthrough_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static void lock_otp_secret0_partition(void) {
106106
CHECK_STATUS_OK(otp_ctrl_testutils_wait_for_dai(&otp));
107107
}
108108

109-
static void lock_otp_secret2_partition() {
109+
static void lock_otp_secret2_partition(void) {
110110
// Write LC RMA tokens to OTP secret2 partition.
111111
uint64_t otp_rma_token_0 = 0;
112112
uint64_t otp_rma_token_1 = 0;

sw/device/tests/sim_dv/pwrmgr_b2b_sleep_reset_test.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static dif_pinmux_t pinmux;
4747
* . set sysrst_ctrl.KEY_INTR_CTL.pwrb_in_H2L to 1
4848
* . use IOR13 as pwrb_in
4949
*/
50-
static void prgm_push_button_wakeup() {
50+
static void prgm_push_button_wakeup(void) {
5151
dif_sysrst_ctrl_input_change_config_t config = {
5252
.input_changes = kDifSysrstCtrlInputPowerButtonH2L,
5353
.debounce_time_threshold = 1, // 5us

sw/device/tests/sim_dv/pwrmgr_sleep_all_wake_ups_impl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const test_wakeup_sources_t kTestWakeupSources[PWRMGR_PARAM_NUM_WKUPS] = {
173173
},
174174
};
175175

176-
void init_units() {
176+
void init_units(void) {
177177
CHECK_DIF_OK(dif_adc_ctrl_init(
178178
mmio_region_from_addr(TOP_EARLGREY_ADC_CTRL_AON_BASE_ADDR), &adc_ctrl));
179179
CHECK_DIF_OK(dif_aon_timer_init(

0 commit comments

Comments
 (0)