[alsa-devel] [PATCH 02/10] ALSA: pcsp: Fix initialization with nopcm=1
Takashi Iwai
tiwai at suse.de
Tue Oct 29 17:00:25 CET 2013
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 at 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
More information about the Alsa-devel
mailing list