mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul <set@pobox.com>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: lkml <linux-kernel@vger.kernel.org>
Subject: Linux 2.4.20-rc2 screwy ac97_codec.c:codec_id()
Date: Thu, 21 Nov 2002 20:14:14 -0500	[thread overview]
Message-ID: <20021122011413.GA1463@squish.home.loc> (raw)
In-Reply-To: <Pine.LNX.4.44L.0211151309400.11268-100000@freak.distro.conectiva>

	Hi;

	Im pretty sure this is broken, but I dont know exactly
what it is trying to do.
	The first snprintf is overwritten regardless-- missing
else block? And its format string should probably be "%4X:%4X",
because whats there wont fit in the buffer.
	Then the first 3 chars in the string are filled in
with raw numbers (For my card, non-ascii) and then a single
decimal digit?? (This string is printed out during boot time--
which is how I noticed it because of the 'garbage' chars.)
	I dont know what a PnP string is supposed to look like...

Paul
set@pobox.com

--- linux-2.4.19/drivers/sound/ac97_codec.c     2002-08-03 00:39:44.000000000 +0 000
+++ linux-2.4.20/drivers/sound/ac97_codec.c     2002-11-15 14:56:52.000000000 +0 000
@@ -654,6 +654,27 @@
 }
  
/**
+ *     codec_id        -  Turn id1/id2 into a PnP string
+ *     @id1: Vendor ID1
+ *     @id2: Vendor ID2
+ *     @buf: 10 byte buffer
+ *
+ *     Fills buf with a zero terminated PnP ident string for the id1/id2
+ *     pair. For convenience the return is the passed in buffer pointer.
+ */
+ 
+static char *codec_id(u16 id1, u16 id2, char *buf)
+{
+       if(id1&0x8080)
+               snprintf(buf, 10, "%0x4X:%0x4X", id1, id2);
+       buf[0] = (id1 >> 8);
+       buf[1] = (id1 & 0xFF);
+       buf[2] = (id2 >> 8);
+       snprintf(buf+3, 7, "%d", id2&0xFF);
+       return buf;
+}



  parent reply	other threads:[~2002-11-22  1:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-15 15:10 Linux 2.4.20-rc2 Marcelo Tosatti
2002-11-15 19:19 ` Linux 2.4.20-rc2 in2000.c and t128.c build fixes (resend) Andreas Steinmetz
2002-11-15 23:04 ` Linux 2.4.20-rc2 Adrian Bunk
2002-11-16  7:16   ` Robert Read
2002-11-16  2:04 ` Keith Owens
2002-11-16 17:22 ` Adrian Bunk
2002-11-22  1:14 ` Paul [this message]
2002-11-22  1:57   ` Linux 2.4.20-rc2 screwy ac97_codec.c:codec_id() Alan Cox
2002-11-22  4:05     ` Paul

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=20021122011413.GA1463@squish.home.loc \
    --to=set@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /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®