Hi Jacopo On Sat, 22 Oct 2022 at 11:13, Jacopo Mondi <jacopo@xxxxxxxxxx> wrote: > > Refuse unsupported controls by returning -EINVAL in the s_ctrl > operation. > > Signed-off-by: Jacopo Mondi <jacopo@xxxxxxxxxx> > > --- > drivers/media/i2c/ar0521.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/media/i2c/ar0521.c b/drivers/media/i2c/ar0521.c > index e673424880ac..fcd852760750 100644 > --- a/drivers/media/i2c/ar0521.c > +++ b/drivers/media/i2c/ar0521.c > @@ -547,6 +547,10 @@ static int ar0521_s_ctrl(struct v4l2_ctrl *ctrl) > ret = ar0521_write_reg(sensor, AR0521_REG_TEST_PATTERN_MODE, > ctrl->val); > break; > + default: > + dev_err(&sensor->i2c_client->dev, > + "Unsupported control %x\n", ctrl->id); > + return -EINVAL; > } > > pm_runtime_put(&sensor->i2c_client->dev); In the default case you've returned without doing the pm_runtime_put, so pm is going to be unbalanced. default: dev_err(...) ret = -EINVAL; break; would avoid that. Dave > -- > 2.37.3 >