* [PATCH] initrd: Remove unnecessary goto label 'successful_load'
@ 2025-09-13 12:15 Thorsten Blum
2025-09-13 13:11 ` Klara Modin
0 siblings, 1 reply; 3+ messages in thread
From: Thorsten Blum @ 2025-09-13 12:15 UTC (permalink / raw)
To: Alexander Viro, Christian Brauner, Jan Kara
Cc: Thorsten Blum, linux-fsdevel, linux-kernel
The goto label 'successful_load' isn't really necessary. Set 'res = 1'
immediately and let 'goto done' handle the rest.
No functional changes.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
init/do_mounts_rd.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index ac021ae6e6fa..97ddcdaba893 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -210,7 +210,7 @@ int __init rd_load_image(char *from)
if (nblocks == 0) {
if (crd_load(decompressor) == 0)
- goto successful_load;
+ res = 1; /* load successful */
goto done;
}
@@ -264,8 +264,6 @@ int __init rd_load_image(char *from)
}
pr_cont("done.\n");
-successful_load:
- res = 1;
done:
fput(in_file);
noclose_input:
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] initrd: Remove unnecessary goto label 'successful_load'
2025-09-13 12:15 [PATCH] initrd: Remove unnecessary goto label 'successful_load' Thorsten Blum
@ 2025-09-13 13:11 ` Klara Modin
2025-09-13 13:30 ` Thorsten Blum
0 siblings, 1 reply; 3+ messages in thread
From: Klara Modin @ 2025-09-13 13:11 UTC (permalink / raw)
To: Thorsten Blum
Cc: Alexander Viro, Christian Brauner, Jan Kara, linux-fsdevel,
linux-kernel
Hi,
On 2025-09-13 14:15:14 +0200, Thorsten Blum wrote:
> The goto label 'successful_load' isn't really necessary. Set 'res = 1'
> immediately and let 'goto done' handle the rest.
>
> No functional changes.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> init/do_mounts_rd.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
> index ac021ae6e6fa..97ddcdaba893 100644
> --- a/init/do_mounts_rd.c
> +++ b/init/do_mounts_rd.c
> @@ -210,7 +210,7 @@ int __init rd_load_image(char *from)
>
> if (nblocks == 0) {
> if (crd_load(decompressor) == 0)
> - goto successful_load;
> + res = 1; /* load successful */
> goto done;
> }
This is now the only place where res will be set to 1.
>
> @@ -264,8 +264,6 @@ int __init rd_load_image(char *from)
> }
> pr_cont("done.\n");
>
> -successful_load:
> - res = 1;
This does not seem correct? After this patch res is not updated to 1 anymore
if execution reaches here without taking another goto, i.e. the return
value is changed by this patch.
Regards,
Klara Modin
> done:
> fput(in_file);
> noclose_input:
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] initrd: Remove unnecessary goto label 'successful_load'
2025-09-13 13:11 ` Klara Modin
@ 2025-09-13 13:30 ` Thorsten Blum
0 siblings, 0 replies; 3+ messages in thread
From: Thorsten Blum @ 2025-09-13 13:30 UTC (permalink / raw)
To: Klara Modin
Cc: Alexander Viro, Christian Brauner, Jan Kara, linux-fsdevel,
linux-kernel
On 13. Sep 2025, at 15:11, Klara Modin wrote:
> On 2025-09-13 14:15:14 +0200, Thorsten Blum wrote:
>> The goto label 'successful_load' isn't really necessary. Set 'res = 1'
>> immediately and let 'goto done' handle the rest.
>>
>> No functional changes.
>>
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
>> ---
>> ...
>
> This is now the only place where res will be set to 1.
Sorry my bad.
> This does not seem correct? After this patch res is not updated to 1 anymore
> if execution reaches here without taking another goto, i.e. the return
> value is changed by this patch.
Thanks, I agree that it doesn't make sense. I only intended to delete
the label, not the 'res = 1'.
Please ignore this patch (unless someone thinks removing the goto label
is worth a v2) and sorry for the noise.
Thanks,
Thorsten
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-13 13:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-13 12:15 [PATCH] initrd: Remove unnecessary goto label 'successful_load' Thorsten Blum
2025-09-13 13:11 ` Klara Modin
2025-09-13 13:30 ` Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox