linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vinod Koul <vkoul@kernel.org>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Bard Liao <yung-chuan.liao@linux.intel.com>,
	Sanyog Kale <sanyog.r.kale@intel.com>,
	linux-arm-msm@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] soundwire: qcom: use signed variable for error return
Date: Wed, 31 Mar 2021 21:18:50 +0530	[thread overview]
Message-ID: <YGSZ4sAwMUA5kQsc@vkoul-mobl.Dlink> (raw)
In-Reply-To: <9cdef4e9-a38a-6c77-1b23-739f85384b12@linux.intel.com>

On 31-03-21, 09:41, Pierre-Louis Bossart wrote:
> 
> 
> On 3/31/21 2:21 AM, Vinod Koul wrote:
> > We get warning for using a unsigned variable being compared to less than
> > zero. The comparison is correct as it checks for errors from previous
> > call to qcom_swrm_get_alert_slave_dev_num(), so we should use a signed
> > variable instead.
> > 
> > drivers/soundwire/qcom.c: qcom_swrm_irq_handler() warn: impossible
> > condition '(devnum < 0) => (0-255 < 0)'
> > 
> > Reported-by: kernel test robot <lkp@intel.com>
> > Signed-off-by: Vinod Koul <vkoul@kernel.org>
> > ---
> >   drivers/soundwire/qcom.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> > index b08ecb9b418c..55ed133c6704 100644
> > --- a/drivers/soundwire/qcom.c
> > +++ b/drivers/soundwire/qcom.c
> > @@ -428,7 +428,7 @@ static irqreturn_t qcom_swrm_irq_handler(int irq, void *dev_id)
> >   	struct qcom_swrm_ctrl *swrm = dev_id;
> >   	u32 value, intr_sts, intr_sts_masked, slave_status;
> >   	u32 i;
> > -	u8 devnum = 0;
> > +	s8 devnum = 0;
> 
> it's not great to store negative error codes with s8. That works in this
> specific case because the function only returns -EINVAL.

Yeah I did check EINVAL was the case which would work but in general I
agree that makes sense, I discussed with Srini on IRC and looks like I
havent posted v2, should hit the pipes shortly

-- 
~Vinod

  reply	other threads:[~2021-03-31 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31  7:21 [PATCH] soundwire: qcom: use signed variable for error return Vinod Koul
2021-03-31 14:41 ` Pierre-Louis Bossart
2021-03-31 15:48   ` Vinod Koul [this message]
2021-03-31 16:24 ` Bjorn Andersson

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=YGSZ4sAwMUA5kQsc@vkoul-mobl.Dlink \
    --to=vkoul@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sanyog.r.kale@intel.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=yung-chuan.liao@linux.intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).