mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Antti Palosaari <crope@iki.fi>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media-owner@vger.kernel.org
Subject: Re: [media-af9013] question about return value in function af9013_wr_regs()
Date: Fri, 09 Jun 2017 15:11:14 +0300	[thread overview]
Message-ID: <63d70a1e4783d95dac79746161f213a0@iki.fi> (raw)
In-Reply-To: <20170608165137.Horde.bWBBH3ahbuGABOWprQvJwWG@gator4166.hostgator.com>

Gustavo A. R. Silva kirjoitti 2017-06-09 00:51:
> Hello everybody,
> 
> While looking into Coverity ID 1227035 I ran into the following piece
> of code at drivers/media/dvb-frontends/af9013.c:595:

> The issue here is that the value stored in variable _ret_ at line 608,
>  is not being evaluated as it happens at line 662, 667, 672 and 677.
> Then after looking into function af9013_wr_regs(), I noticed that this
>  function always returns zero, no matter what, as you can see below:
> 
> 121static int af9013_wr_regs(struct af9013_state *priv, u16 reg, const  
> u8 *val,
> 122        int len)
> 123{
> 124        int ret, i;
> 125        u8 mbox = (0 << 7)|(0 << 6)|(1 << 1)|(1 << 0);
> 126
> 127        if ((priv->config.ts_mode == AF9013_TS_USB) &&
> 128                ((reg & 0xff00) != 0xff00) && ((reg & 0xff00) != 
> 0xae00)) {
> 129                mbox |= ((len - 1) << 2);
> 130                ret = af9013_wr_regs_i2c(priv, mbox, reg, val, len);
> 131        } else {
> 132                for (i = 0; i < len; i++) {
> 133                        ret = af9013_wr_regs_i2c(priv, mbox, reg+i,
>  val+i, 1);
> 134                        if (ret)
> 135                                goto err;
> 136                }
> 137        }
> 138
> 139err:
> 140        return 0;
> 141}

That function should return error code on error case, not zero always.


regards
Antti




-- 
http://palosaari.fi/

      reply	other threads:[~2017-06-09 12:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-08 21:51 Gustavo A. R. Silva
2017-06-09 12:11 ` Antti Palosaari [this message]

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=63d70a1e4783d95dac79746161f213a0@iki.fi \
    --to=crope@iki.fi \
    --cc=garsilva@embeddedor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media-owner@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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

all inboxes | Powered by JetHome®