Skip to contentSkip to conversation

media: ccs: complement the return check of pm_runtime_get_if_active()

PATCH Sakari Ailus 1 participant 1 message Nov 19, 2021 1 message not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi Peiwei,

Quoted 13 lines · Peiwei Hu

pm_runtime_get_if_active() can return the negative value. The operator ! confuses the negative one with positive situation.

---
 drivers/media/i2c/ccs/ccs-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ccs/ccs-core.c +0 -0
index 5363f3bcafe3..84e810451dd4 100644

drivers/media/i2c/ccs/ccs-core.c static int ccs_set_ctrl(struct v4l2_ctrl *ctrl) · line 675

Quoted 7 lines
drivers/media/i2c/ccs/ccs-core.c +1 -1
@@ -670,7 +670,7 @@ static int ccs_set_ctrl(struct v4l2_ctrl *ctrl)
 		break;
 	}
 
-	pm_status = pm_runtime_get_if_active(&client->dev, true);
+	pm_status = pm_runtime_get_if_active(&client->dev, true) > 0;
 	if (!pm_status)
 		return 0;

This is intentional --- pm_runtime_get_if_active() returns an error if runtime PM is disabled.

Signature · 3 lines
Regards,

Sakari Ailus