diff options
| -rw-r--r-- | kernel/cpu.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 042fd7e8e030..f75c4d031eeb 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
| @@ -1471,6 +1471,7 @@ int __cpuhp_setup_state(enum cpuhp_state state, | |||
| 1471 | bool multi_instance) | 1471 | bool multi_instance) |
| 1472 | { | 1472 | { |
| 1473 | int cpu, ret = 0; | 1473 | int cpu, ret = 0; |
| 1474 | bool dynstate; | ||
| 1474 | 1475 | ||
| 1475 | if (cpuhp_cb_check(state) || !name) | 1476 | if (cpuhp_cb_check(state) || !name) |
| 1476 | return -EINVAL; | 1477 | return -EINVAL; |
| @@ -1480,6 +1481,12 @@ int __cpuhp_setup_state(enum cpuhp_state state, | |||
| 1480 | ret = cpuhp_store_callbacks(state, name, startup, teardown, | 1481 | ret = cpuhp_store_callbacks(state, name, startup, teardown, |
| 1481 | multi_instance); | 1482 | multi_instance); |
| 1482 | 1483 | ||
| 1484 | dynstate = state == CPUHP_AP_ONLINE_DYN; | ||
| 1485 | if (ret > 0 && dynstate) { | ||
| 1486 | state = ret; | ||
| 1487 | ret = 0; | ||
| 1488 | } | ||
| 1489 | |||
| 1483 | if (ret || !invoke || !startup) | 1490 | if (ret || !invoke || !startup) |
| 1484 | goto out; | 1491 | goto out; |
| 1485 | 1492 | ||
| @@ -1508,7 +1515,7 @@ out: | |||
| 1508 | * If the requested state is CPUHP_AP_ONLINE_DYN, return the | 1515 | * If the requested state is CPUHP_AP_ONLINE_DYN, return the |
| 1509 | * dynamically allocated state in case of success. | 1516 | * dynamically allocated state in case of success. |
| 1510 | */ | 1517 | */ |
| 1511 | if (!ret && state == CPUHP_AP_ONLINE_DYN) | 1518 | if (!ret && dynstate) |
| 1512 | return state; | 1519 | return state; |
| 1513 | return ret; | 1520 | return ret; |
| 1514 | } | 1521 | } |
