Hi,
On 05/11/2017 08:30 AM, Tomasz Figa wrote:
>> +static int dw9714_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
>> +{
>> + struct dw9714_device *dw9714_dev = container_of(sd,
>> + struct dw9714_device,
>> + sd);
>> + struct device *dev = &dw9714_dev->client->dev;
>> + int rval;
>> +
>> + rval = pm_runtime_get_sync(dev);
>> + if (rval >= 0)
>> + return 0;
>> +
>> + pm_runtime_put(dev);
>> + return rval;
>>
> nit: The typical coding style is to return early in case of a special
> case and keep the common path linear, i.e.
>
> rval = pm_runtime_get_sync(dev);
> if (rval < 0) {
> pm_runtime_put(dev);
> return rval;
> }
Aren't we supposed to call pm_runtime_put() only when corresponding
pm_runtime_get() succeeds? I think the pm_runtime_put() call above
is not needed.
--
Regards,
Sylwester