linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Colin Ian King <colin.king@canonical.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: sgtl5000: avoid division by zero if lo_vag is zero
Date: Thu, 6 Sep 2018 13:01:58 +0100	[thread overview]
Message-ID: <43293b8e-5b9d-ff51-aa3f-eb1a7b9490aa@canonical.com> (raw)
In-Reply-To: <20180906115814.a5woyhfc5sczxksa@mwanda>

On 06/09/18 12:58, Dan Carpenter wrote:
> On Thu, Sep 06, 2018 at 11:41:52AM +0100, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> In the case where lo_vag <= SGTL5000_LINE_OUT_GND_BASE, lo_vag
>> is set to zero and later vol_quot is computed by dividing by
>> lo_vag causing a division by zero error.  Fix this by avoiding
>> a zero division and set vol_quot to zero in this specific case
>> so that the lowest setting for i is correctly set.
>>
> 
> This is a very clever patch.  How did you find the bug?

trawling through a lot of false positives from a recent cppcheck run

> 
> regards,
> dan carpenter
> 


      reply	other threads:[~2018-09-06 12:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 10:41 [PATCH] ASoC: sgtl5000: avoid division by zero if lo_vag is zero Colin King
2018-09-06 11:09 ` Applied "ASoC: sgtl5000: avoid division by zero if lo_vag is zero" to the asoc tree Mark Brown
2018-09-06 11:58 ` [PATCH] ASoC: sgtl5000: avoid division by zero if lo_vag is zero Dan Carpenter
2018-09-06 12:01   ` Colin Ian King [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=43293b8e-5b9d-ff51-aa3f-eb1a7b9490aa@canonical.com \
    --to=colin.king@canonical.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=fabio.estevam@nxp.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.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).