public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrzej Hajda <a.hajda@samsung.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [media] Add driver for Samsung S5K5BAF camera sensor
Date: Wed, 08 Jan 2014 12:58:35 +0100	[thread overview]
Message-ID: <52CD3D6B.9000400@samsung.com> (raw)
In-Reply-To: <20140108095840.GA10979@elgon.mountain>

On 01/08/2014 10:58 AM, Dan Carpenter wrote:
> Hello Andrzej Hajda,
> 
> The patch 7d459937dc09: "[media] Add driver for Samsung S5K5BAF
> camera sensor" from Dec 5, 2013, leads to the following
> static checker warning:
> 
> 	drivers/media/i2c/s5k5baf.c:1043 s5k5baf_set_power()
> 	warn: add some parenthesis here?
> 
> drivers/media/i2c/s5k5baf.c
>   1036  static int s5k5baf_set_power(struct v4l2_subdev *sd, int on)
>   1037  {
>   1038          struct s5k5baf *state = to_s5k5baf(sd);
>   1039          int ret = 0;
>   1040  
>   1041          mutex_lock(&state->lock);
>   1042  
>   1043          if (!on != state->power)
>                     ^^^^^^^^^^^^^^^^^^^
> This would be cleaner if it were "if (on == state->power)"

This version works correctly only for 'on' equal 0 and 1, my version
works for all ints. On the other side documentation says only 0 and 1 is
allowed for s_power callbacks :)
I would stay with my version, similar approach is in other drivers.

Regards
Andrzej

> 
>   1044                  goto out;
>   1045  
>   1046          if (on) {
> 
> regards,
> dan carpenter
> 


  reply	other threads:[~2014-01-08 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08  9:58 [media] Add driver for Samsung S5K5BAF camera sensor Dan Carpenter
2014-01-08 11:58 ` Andrzej Hajda [this message]
2014-01-08 12:45   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2014-01-08  9:09 Dan Carpenter
2014-01-08 10:29 ` Sachin Kamat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52CD3D6B.9000400@samsung.com \
    --to=a.hajda@samsung.com \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox