[PATCH v2 07/21] kallsyms: reimplement mksysmap in C

Markus Elfring Markus.Elfring at web.de
Mon Sep 14 09:54:33 PDT 2026


…
> +++ b/scripts/kallsyms.c
…
> @@ -838,13 +834,33 @@ int main(int argc, char **argv)
…
> +	in = argv[optind];
> +	if (sysmap) {
> +		sysmap_out = fopen(sysmap, "w");
> +		if (!sysmap_out) {
> +			perror(sysmap);
> +			exit(EXIT_FAILURE);
> +		}
> +	}
> +
> +	if (optind + 1 == argc) {
> +		read_elf(in, sysmap_out);
> +		if (fclose(sysmap_out)) {
> +			perror(sysmap);
> +			exit(EXIT_FAILURE);
> +		}
> +		return 0;
> +	}
> +
>  	out_bin_name = argv[optind + 1];
>  	out_bin_file = fopen(out_bin_name, "w");
>  	if (!out_bin_file) {
…


How do you think about to avoid a bit duplicate source code
by using a goto chain?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v7.3-rc3#n572

Regards,
Markus



More information about the linux-riscv mailing list