From 504c950c155ccfad7e570e766dfbaa719660c667 Mon Sep 17 00:00:00 2001 From: Niklas Elsbrock Date: Tue, 29 Apr 2025 20:26:38 +0200 Subject: [PATCH] remove unnecessary return value of `tictactoe_game_init` --- tictactoe_game.c | 4 +--- tictactoe_game.h | 2 +- tictactoe_main.c | 7 +------ 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tictactoe_game.c b/tictactoe_game.c index 75b0248..246010d 100644 --- a/tictactoe_game.c +++ b/tictactoe_game.c @@ -7,7 +7,7 @@ /* * Initializes a new game instance. */ -int tictactoe_game_init(ttt_game_t *game) +void tictactoe_game_init(ttt_game_t *game) { game->next_turn = 'X'; game->winner = 0; @@ -16,8 +16,6 @@ int tictactoe_game_init(ttt_game_t *game) game->board[x][y] = ' '; } } - - return 0; } /* diff --git a/tictactoe_game.h b/tictactoe_game.h index d3cab1b..6a972bf 100644 --- a/tictactoe_game.h +++ b/tictactoe_game.h @@ -9,7 +9,7 @@ typedef struct tictactoe_game { char board[3][3]; } ttt_game_t; -int tictactoe_game_init(ttt_game_t *game); +void tictactoe_game_init(ttt_game_t *game); int tictactoe_game_make_turn(ttt_game_t *game, size_t x, size_t y); int tictactoe_game_snprint(ttt_game_t *game, char *buf, size_t len); diff --git a/tictactoe_main.c b/tictactoe_main.c index 730f96d..d863180 100644 --- a/tictactoe_main.c +++ b/tictactoe_main.c @@ -225,12 +225,7 @@ static int __init tictactoe_init(void) tictactoe_error("failed to allocate game memory\n"); return -EFAULT; } - ret = tictactoe_game_init(tictactoe_current_game); - if (ret) { - mutex_unlock(&tictactoe_mutex_current_game); - tictactoe_error("failed to initialize game\n"); - return -EFAULT; - } + tictactoe_game_init(tictactoe_current_game); mutex_unlock(&tictactoe_mutex_current_game); ret = misc_register(&tictactoe_dev);