From: Tobias Stoeckmann Date: Wed, 19 Feb 2025 18:35:51 +0000 (+0100) Subject: static-nodes: unify return statements X-Git-Tag: v34~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51ba885d5bea5962b10788f0b2a36f806b74a690;p=thirdparty%2Fkmod.git static-nodes: unify return statements The write_* functions have different return statement handling. Unify them by removing "else" if the if-block itself returns and also unify the error handling by checking for the error case, leaving the success return statement at the end of the function. Signed-off-by: Tobias Stoeckmann Link: https://github.com/kmod-project/kmod/pull/285 Signed-off-by: Lucas De Marchi --- diff --git a/tools/static-nodes.c b/tools/static-nodes.c index f4eeeb69..9af30eb8 100644 --- a/tools/static-nodes.c +++ b/tools/static-nodes.c @@ -59,10 +59,10 @@ static int write_human(FILE *out, char modname[], char devname[], char type, "\t\tMajor: %u\n" "\t\tMinor: %u\n", modname, devname, (type == 'c') ? "character" : "block", maj, min); - if (ret >= 0) - return EXIT_SUCCESS; - else + if (ret < 0) return EXIT_FAILURE; + + return EXIT_SUCCESS; } static const struct static_nodes_format static_nodes_format_human = { @@ -104,10 +104,10 @@ static int write_devname(FILE *out, char modname[], char devname[], char type, int ret; ret = fprintf(out, "%s %s %c%u:%u\n", modname, devname, type, maj, min); - if (ret >= 0) - return EXIT_SUCCESS; - else + if (ret < 0) return EXIT_FAILURE; + + return EXIT_SUCCESS; } static const struct static_nodes_format static_nodes_format_devname = {