Message ID | 20221022092015.208592-6-jacopo@jmondi.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | media: ar0521: Add analog gain, rework clock tree | expand |
Hi Jacopo On Sat, 22 Oct 2022 at 11:13, Jacopo Mondi <jacopo@jmondi.org> wrote: > > Refuse unsupported controls by returning -EINVAL in the s_ctrl > operation. > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > --- > 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 >
Ups, trivial mistake sorry Thanks for spotting On Mon, Oct 24, 2022 at 02:00:28PM +0100, Dave Stevenson wrote: > Hi Jacopo > > On Sat, 22 Oct 2022 at 11:13, Jacopo Mondi <jacopo@jmondi.org> wrote: > > > > Refuse unsupported controls by returning -EINVAL in the s_ctrl > > operation. > > > > Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> > > > > --- > > 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 > >
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);
Refuse unsupported controls by returning -EINVAL in the s_ctrl operation. Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> --- drivers/media/i2c/ar0521.c | 4 ++++ 1 file changed, 4 insertions(+)