Re: [PATCH v4] dw9714: Initial driver for dw9714 VCM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux