From 175649e23691c51d4d168bc0beadd94a45858ad3 Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Mon, 17 Aug 2026 10:46:35 +0200 Subject: [PATCH] Fix spinup and spindown failure when skipping non-rotational devices --- cmdline/mingwapp.c | 8 ++++++-- cmdline/unixapp.c | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmdline/mingwapp.c b/cmdline/mingwapp.c index 55ee4369..2d6435b7 100644 --- a/cmdline/mingwapp.c +++ b/cmdline/mingwapp.c @@ -1584,7 +1584,7 @@ static void* thread_spinup(void* arg) /* skip not rotational devices */ if (devpower(devinfo->device, devinfo->name, devinfo->wfile) == 0) - return (void*)-1; + return 0; start = os_tick_ms(); @@ -1624,7 +1624,7 @@ static void* thread_spindown(void* arg) /* skip not rotational devices */ if (devpower(devinfo->device, devinfo->name, devinfo->wfile) == 0) - return (void*)-1; + return 0; start = os_tick_ms(); @@ -1648,6 +1648,10 @@ static void* thread_spindownifup(void* arg) uint64_t start; int power; + /* skip not rotational devices */ + if (devpower(devinfo->device, devinfo->name, devinfo->wfile) == 0) + return 0; + start = os_tick_ms(); if (devdownifup(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smartctl_info, &power) != 0) { diff --git a/cmdline/unixapp.c b/cmdline/unixapp.c index 7b329f19..86277183 100644 --- a/cmdline/unixapp.c +++ b/cmdline/unixapp.c @@ -3475,7 +3475,7 @@ static void* thread_spinup(void* arg) /* skip not rotational devices */ if (devpower(devinfo->device) == 0) - return (void*)-1; + return 0; start = os_tick_ms(); @@ -3520,7 +3520,7 @@ static void* thread_spindown(void* arg) /* skip not rotational devices */ if (devpower(devinfo->device) == 0) - return (void*)-1; + return 0; start = os_tick_ms(); @@ -3549,6 +3549,10 @@ static void* thread_spindownifup(void* arg) uint64_t start; int power; + /* skip not rotational devices */ + if (devpower(devinfo->device) == 0) + return 0; + start = os_tick_ms(); if (devdownifup(devinfo->device, devinfo->name, devinfo->smartctl, devinfo->smartctl_info, &power) != 0) {