mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 17:53:56 +08:00
powerpc/kexec: Use common error handling code in setup_new_fdt()
Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Reviewed-by: Thiago Jung Bauermann <bauerman@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
parent
302c7b0c4f
commit
baedcdf505
@ -269,18 +269,14 @@ int setup_new_fdt(const struct kimage *image, void *fdt,
|
||||
ret = fdt_setprop_u64(fdt, chosen_node,
|
||||
"linux,initrd-start",
|
||||
initrd_load_addr);
|
||||
if (ret < 0) {
|
||||
pr_err("Error setting up the new device tree.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
/* initrd-end is the first address after the initrd image. */
|
||||
ret = fdt_setprop_u64(fdt, chosen_node, "linux,initrd-end",
|
||||
initrd_load_addr + initrd_len);
|
||||
if (ret < 0) {
|
||||
pr_err("Error setting up the new device tree.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
|
||||
ret = fdt_add_mem_rsv(fdt, initrd_load_addr, initrd_len);
|
||||
if (ret) {
|
||||
@ -292,10 +288,8 @@ int setup_new_fdt(const struct kimage *image, void *fdt,
|
||||
|
||||
if (cmdline != NULL) {
|
||||
ret = fdt_setprop_string(fdt, chosen_node, "bootargs", cmdline);
|
||||
if (ret < 0) {
|
||||
pr_err("Error setting up the new device tree.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ret < 0)
|
||||
goto err;
|
||||
} else {
|
||||
ret = fdt_delprop(fdt, chosen_node, "bootargs");
|
||||
if (ret && ret != -FDT_ERR_NOTFOUND) {
|
||||
@ -311,10 +305,12 @@ int setup_new_fdt(const struct kimage *image, void *fdt,
|
||||
}
|
||||
|
||||
ret = fdt_setprop(fdt, chosen_node, "linux,booted-from-kexec", NULL, 0);
|
||||
if (ret) {
|
||||
pr_err("Error setting up the new device tree.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
pr_err("Error setting up the new device tree.\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user