Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scripts: ipe: polgen: remove redundant close and error exit path

Currently if an fopen fails the error exit path is via code that
checks if fp is not null and closes the file, however, fp is null
so this check and close is redundant. Since the only use of the
err exit label is on the fopen check, remove it and replace the
code with a simple return of errno. Also remove variable rc since
it's no longer required.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Fan Wu <wufan@kernel.org>

authored by

Colin Ian King and committed by
Fan Wu
9080d11a adc21867

+2 -10
+2 -10
scripts/ipe/polgen/polgen.c
··· 61 61 62 62 static int write_boot_policy(const char *pathname, const char *buf, size_t size) 63 63 { 64 - int rc = 0; 65 64 FILE *fd; 66 65 size_t i; 67 66 68 67 fd = fopen(pathname, "w"); 69 - if (!fd) { 70 - rc = errno; 71 - goto err; 72 - } 68 + if (!fd) 69 + return errno; 73 70 74 71 fprintf(fd, "/* This file is automatically generated."); 75 72 fprintf(fd, " Do not edit. */\n"); ··· 110 113 fclose(fd); 111 114 112 115 return 0; 113 - 114 - err: 115 - if (fd) 116 - fclose(fd); 117 - return rc; 118 116 } 119 117 120 118 int main(int argc, const char *const argv[])