alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 02/10] ALSA: pcsp: Fix initialization with nopcm=1
Date: Tue, 29 Oct 2013 17:00:25 +0100	[thread overview]
Message-ID: <1383062433-9388-3-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1383062433-9388-1-git-send-email-tiwai@suse.de>

When nopcm=1 is set, some initializations based on hrtimer resolution
might be bogus because the driver checks the resolution only when
nopcm=0.  Simply get the resolution always at first for fixing the
bug.

Spotted by coverity CID 139740.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/drivers/pcsp/pcsp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index 1c19cd7ad26e..f664bae3b9b0 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -46,8 +46,9 @@ static int snd_pcsp_create(struct snd_card *card)
 	int err;
 	int div, min_div, order;
 
+	hrtimer_get_res(CLOCK_MONOTONIC, &tp);
+
 	if (!nopcm) {
-		hrtimer_get_res(CLOCK_MONOTONIC, &tp);
 		if (tp.tv_sec || tp.tv_nsec > PCSP_MAX_PERIOD_NS) {
 			printk(KERN_ERR "PCSP: Timer resolution is not sufficient "
 				"(%linS)\n", tp.tv_nsec);
-- 
1.8.4.1

  parent reply	other threads:[~2013-10-29 15:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-29 16:00 [PATCH 00/10] Yet another small covery bug fixes Takashi Iwai
2013-10-29 16:00 ` [PATCH 01/10] ALSA: opl3: Fix possible negative array index access Takashi Iwai
2013-10-29 16:00 ` Takashi Iwai [this message]
2013-10-29 16:00 ` [PATCH 03/10] ALSA: Limit the fallback card id string size Takashi Iwai
2013-10-29 16:00 ` [PATCH 04/10] ALSA: Use strlcpy() instead of strncpy() Takashi Iwai
2013-10-29 16:00 ` [PATCH 05/10] ALSA: ad1889: Fix right attenuation proc output Takashi Iwai
2013-10-29 16:00 ` [PATCH 06/10] ALSA: ali5451: Drop unused variable Takashi Iwai
2013-10-29 16:00 ` [PATCH 07/10] ALSA: rme96: Return error code in PCM copy ops Takashi Iwai
2013-11-15  9:40   ` Knut Petersen
2013-11-15  9:53     ` Takashi Iwai
2013-10-29 16:00 ` [PATCH 08/10] ALSA: ak4114: Fix wrong register array size Takashi Iwai
2013-10-29 16:00 ` [PATCH 09/10] ALSA: ice1724: Fix uninitialized variable access Takashi Iwai
2013-10-29 16:00 ` [PATCH 10/10] ALSA: lola: Fix uninitialized variable access in error message Takashi Iwai

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=1383062433-9388-3-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.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;
as well as URLs for NNTP newsgroup(s).