diff mbox series

cpuidle: remove dead code in cpuidle_enter_state

Message ID 20240821114250.1416421-1-d-gole@ti.com (mailing list archive)
State Mainlined, archived
Headers show
Series cpuidle: remove dead code in cpuidle_enter_state | expand

Commit Message

Dhruva Gole Aug. 21, 2024, 11:42 a.m. UTC
Checking for index < 0 is useless because the find_deepest_state
function never really returns a negative value. Since this code hasn't
been reported in over 9 years it's dead code. Hence, remove it.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
---

Discussions on the original series that added this code:
https://lore.kernel.org/linux-pm/20240821095105.xuf2a5xe3yxqqewj@lcpd911/T/#u

 drivers/cpuidle/cpuidle.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)


base-commit: bb1b0acdcd66e0d8eedee3570d249e076b89ab32

Comments

Rafael J. Wysocki Aug. 22, 2024, 7:06 p.m. UTC | #1
On Wed, Aug 21, 2024 at 1:43 PM Dhruva Gole <d-gole@ti.com> wrote:
>
> Checking for index < 0 is useless because the find_deepest_state
> function never really returns a negative value. Since this code hasn't
> been reported in over 9 years it's dead code. Hence, remove it.
>
> Signed-off-by: Dhruva Gole <d-gole@ti.com>
> ---
>
> Discussions on the original series that added this code:
> https://lore.kernel.org/linux-pm/20240821095105.xuf2a5xe3yxqqewj@lcpd911/T/#u
>
>  drivers/cpuidle/cpuidle.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index 02e40fd7d948..9e418aec1755 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -228,10 +228,7 @@ noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
>         if (broadcast && tick_broadcast_enter()) {
>                 index = find_deepest_state(drv, dev, target_state->exit_latency_ns,
>                                            CPUIDLE_FLAG_TIMER_STOP, false);
> -               if (index < 0) {
> -                       default_idle_call();
> -                       return -EBUSY;
> -               }
> +
>                 target_state = &drv->states[index];
>                 broadcast = false;
>         }
>

Applied as 6.12 material, thanks!
diff mbox series

Patch

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 02e40fd7d948..9e418aec1755 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -228,10 +228,7 @@  noinstr int cpuidle_enter_state(struct cpuidle_device *dev,
 	if (broadcast && tick_broadcast_enter()) {
 		index = find_deepest_state(drv, dev, target_state->exit_latency_ns,
 					   CPUIDLE_FLAG_TIMER_STOP, false);
-		if (index < 0) {
-			default_idle_call();
-			return -EBUSY;
-		}
+
 		target_state = &drv->states[index];
 		broadcast = false;
 	}