aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnju T Sudhakar <anju@linux.vnet.ibm.com>2019-05-20 14:27:53 +0530
committerPaul Gortmaker <paul.gortmaker@windriver.com>2019-09-16 12:21:34 -0400
commit73940f2a969da142af11c1ed90fafa6ef61fe491 (patch)
tree06f9bbab1f6c13dbceb6b5bfeae9fdb0ca6a5b53
parent72b731cc1fa3acf8c5433ad9e9eefb8839bd5ac8 (diff)
downloadlinux-yocto-73940f2a969da142af11c1ed90fafa6ef61fe491.tar.gz
linux-yocto-73940f2a969da142af11c1ed90fafa6ef61fe491.tar.bz2
linux-yocto-73940f2a969da142af11c1ed90fafa6ef61fe491.zip
powerpc/powernv: Return for invalid IMC domain
commit b59bd3527fe3c1939340df558d7f9d568fc9f882 upstream. Currently init_imc_pmu() can fail either because we try to register an IMC unit with an invalid domain (i.e an IMC node not supported by the kernel) or something went wrong while registering a valid IMC unit. In both the cases kernel provides a 'Register failed' error message. For example when trace-imc node is not supported by the kernel, but skiboot advertises a trace-imc node we print: IMC Unknown Device type IMC PMU (null) Register failed To avoid confusion just print the unknown device type message, before attempting PMU registration, so the second message isn't printed. Fixes: 8f95faaac56c ("powerpc/powernv: Detect and create IMC device") Reported-by: Pavaman Subramaniyam <pavsubra@in.ibm.com> Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com> Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> [mpe: Reword change log a bit] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--arch/powerpc/platforms/powernv/opal-imc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c
index 3d27f02695e4..828f6656f8f7 100644
--- a/arch/powerpc/platforms/powernv/opal-imc.c
+++ b/arch/powerpc/platforms/powernv/opal-imc.c
@@ -161,6 +161,10 @@ static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
struct imc_pmu *pmu_ptr;
u32 offset;
+ /* Return for unknown domain */
+ if (domain < 0)
+ return -EINVAL;
+
/* memory for pmu */
pmu_ptr = kzalloc(sizeof(*pmu_ptr), GFP_KERNEL);
if (!pmu_ptr)