powerpc/powernv: Return for invalid IMC domain

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>

authored by Anju T Sudhakar and committed by Michael Ellerman b59bd352 a188339c

+4
+4
arch/powerpc/platforms/powernv/opal-imc.c
··· 161 struct imc_pmu *pmu_ptr; 162 u32 offset; 163 164 /* memory for pmu */ 165 pmu_ptr = kzalloc(sizeof(*pmu_ptr), GFP_KERNEL); 166 if (!pmu_ptr)
··· 161 struct imc_pmu *pmu_ptr; 162 u32 offset; 163 164 + /* Return for unknown domain */ 165 + if (domain < 0) 166 + return -EINVAL; 167 + 168 /* memory for pmu */ 169 pmu_ptr = kzalloc(sizeof(*pmu_ptr), GFP_KERNEL); 170 if (!pmu_ptr)