]>
Commit | Line | Data |
---|---|---|
a15a8890 SL |
1 | From d8f5f5c1ca15e857b32adc76be3f07fd50c80a27 Mon Sep 17 00:00:00 2001 |
2 | From: Anju T Sudhakar <anju@linux.vnet.ibm.com> | |
3 | Date: Mon, 20 May 2019 14:27:53 +0530 | |
4 | Subject: powerpc/powernv: Return for invalid IMC domain | |
5 | ||
6 | [ Upstream commit b59bd3527fe3c1939340df558d7f9d568fc9f882 ] | |
7 | ||
8 | Currently init_imc_pmu() can fail either because we try to register an | |
9 | IMC unit with an invalid domain (i.e an IMC node not supported by the | |
10 | kernel) or something went wrong while registering a valid IMC unit. In | |
11 | both the cases kernel provides a 'Register failed' error message. | |
12 | ||
13 | For example when trace-imc node is not supported by the kernel, but | |
14 | skiboot advertises a trace-imc node we print: | |
15 | ||
16 | IMC Unknown Device type | |
17 | IMC PMU (null) Register failed | |
18 | ||
19 | To avoid confusion just print the unknown device type message, before | |
20 | attempting PMU registration, so the second message isn't printed. | |
21 | ||
22 | Fixes: 8f95faaac56c ("powerpc/powernv: Detect and create IMC device") | |
23 | Reported-by: Pavaman Subramaniyam <pavsubra@in.ibm.com> | |
24 | Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com> | |
25 | Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> | |
26 | [mpe: Reword change log a bit] | |
27 | Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> | |
28 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
29 | --- | |
30 | arch/powerpc/platforms/powernv/opal-imc.c | 4 ++++ | |
31 | 1 file changed, 4 insertions(+) | |
32 | ||
33 | diff --git a/arch/powerpc/platforms/powernv/opal-imc.c b/arch/powerpc/platforms/powernv/opal-imc.c | |
34 | index 3d27f02695e4..828f6656f8f7 100644 | |
35 | --- a/arch/powerpc/platforms/powernv/opal-imc.c | |
36 | +++ b/arch/powerpc/platforms/powernv/opal-imc.c | |
37 | @@ -161,6 +161,10 @@ static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain) | |
38 | struct imc_pmu *pmu_ptr; | |
39 | u32 offset; | |
40 | ||
41 | + /* Return for unknown domain */ | |
42 | + if (domain < 0) | |
43 | + return -EINVAL; | |
44 | + | |
45 | /* memory for pmu */ | |
46 | pmu_ptr = kzalloc(sizeof(*pmu_ptr), GFP_KERNEL); | |
47 | if (!pmu_ptr) | |
48 | -- | |
49 | 2.20.1 | |
50 |