summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell Currey <ruscur@russell.cc>2022-08-10 15:43:31 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2022-08-10 15:55:20 +1000
commit83ee9f23763a432a4077bf20624ee35de87bce99 (patch)
tree4d24aa1f943b19d3271d6d2acd3648aaf99bfecb
parent59bab33a4f57f886c5f8a4d1f2bed728ec185d16 (diff)
downloadlinux-stable-83ee9f23763a432a4077bf20624ee35de87bce99.tar.gz
linux-stable-83ee9f23763a432a4077bf20624ee35de87bce99.tar.bz2
linux-stable-83ee9f23763a432a4077bf20624ee35de87bce99.zip
powerpc/kexec: Fix build failure from uninitialised variable
clang 14 won't build because ret is uninitialised and can be returned if both prop and fdtprop are NULL. Drop the ret variable and return an error in that failure case. Fixes: b1fc44eaa9ba ("pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window") Suggested-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Russell Currey <ruscur@russell.cc> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220810054331.373761-1-ruscur@russell.cc
-rw-r--r--arch/powerpc/kexec/file_load_64.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
index 683462e4556b..349a781cea0b 100644
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -1043,17 +1043,17 @@ static int copy_property(void *fdt, int node_offset, const struct device_node *d
const char *propname)
{
const void *prop, *fdtprop;
- int len = 0, fdtlen = 0, ret;
+ int len = 0, fdtlen = 0;
prop = of_get_property(dn, propname, &len);
fdtprop = fdt_getprop(fdt, node_offset, propname, &fdtlen);
if (fdtprop && !prop)
- ret = fdt_delprop(fdt, node_offset, propname);
+ return fdt_delprop(fdt, node_offset, propname);
else if (prop)
- ret = fdt_setprop(fdt, node_offset, propname, prop, len);
-
- return ret;
+ return fdt_setprop(fdt, node_offset, propname, prop, len);
+ else
+ return -FDT_ERR_NOTFOUND;
}
static int update_pci_dma_nodes(void *fdt, const char *dmapropname)