diff mbox

[7/7] mkfs: remove gotos in parse_defaults_file

Message ID 1528831883-21879-8-git-send-email-sandeen@sandeen.net (mailing list archive)
State New, archived
Headers show

Commit Message

Eric Sandeen June 12, 2018, 7:31 p.m. UTC
There's no point to the gotos in parse_defaults_file; no cleanup
etc that is normally facilitated by a goto, so just remove them.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
---
 mkfs/config.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Darrick J. Wong June 12, 2018, 10:23 p.m. UTC | #1
On Tue, Jun 12, 2018 at 02:31:23PM -0500, Eric Sandeen wrote:
> There's no point to the gotos in parse_defaults_file; no cleanup
> etc that is normally facilitated by a goto, so just remove them.
> 
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> ---
>  mkfs/config.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mkfs/config.c b/mkfs/config.c
> index 173ab9a..f9ca78a 100644
> --- a/mkfs/config.c
> +++ b/mkfs/config.c
> @@ -636,17 +636,15 @@ parse_defaults_file(
>  
>  	fp = fdopen(fd, "r");
>  	if (!fp)
> -		goto out;
> +		return -1;
>  
>  	ret = parse_config_stream(dft, config_file, fp);
>  	if (ret) {
>  		fclose(fp);
> -		goto out;
> +		return -1;
>  	}

Separate patch, but don't we leak fp here?

Everything else seems ok to me,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

>  
>  	printf(_("config-file=%s\n"), config_file);
>  
>  	return 0;
> -out:
> -	return -1;
>  }
> -- 
> 1.8.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/mkfs/config.c b/mkfs/config.c
index 173ab9a..f9ca78a 100644
--- a/mkfs/config.c
+++ b/mkfs/config.c
@@ -636,17 +636,15 @@  parse_defaults_file(
 
 	fp = fdopen(fd, "r");
 	if (!fp)
-		goto out;
+		return -1;
 
 	ret = parse_config_stream(dft, config_file, fp);
 	if (ret) {
 		fclose(fp);
-		goto out;
+		return -1;
 	}
 
 	printf(_("config-file=%s\n"), config_file);
 
 	return 0;
-out:
-	return -1;
 }