]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
media: i2c: ccs: Set the device's runtime PM status correctly in remove
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 10 Jan 2025 12:50:27 +0000 (14:50 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Sat, 15 Feb 2025 14:22:50 +0000 (15:22 +0100)
Set the device's runtime PM status to suspended in device removal only if
it wasn't suspended already.

Fixes: 9447082ae666 ("[media] smiapp: Implement power-on and power-off sequences without runtime PM")
Cc: stable@vger.kernel.org # for >= v5.15
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/i2c/ccs/ccs-core.c

index 2cdab2f3d9dc3da9b565f35a1af198ae607ac7e6..45b317216abac270baaedde4de272a3b678950c4 100644 (file)
@@ -3595,9 +3595,10 @@ static void ccs_remove(struct i2c_client *client)
        v4l2_async_unregister_subdev(subdev);
 
        pm_runtime_disable(&client->dev);
-       if (!pm_runtime_status_suspended(&client->dev))
+       if (!pm_runtime_status_suspended(&client->dev)) {
                ccs_power_off(&client->dev);
-       pm_runtime_set_suspended(&client->dev);
+               pm_runtime_set_suspended(&client->dev);
+       }
 
        for (i = 0; i < sensor->ssds_used; i++)
                v4l2_device_unregister_subdev(&sensor->ssds[i].sd);