svn commit: r190547 - in stable/7/sys: . contrib/pf dev/ath/ath_hal dev/cxgb dev/sound/pci/hda

Alexander Motin mav at FreeBSD.org
Mon Mar 30 03:18:45 PDT 2009


Author: mav
Date: Mon Mar 30 10:18:43 2009
New Revision: 190547
URL: http://svn.freebsd.org/changeset/base/190547

Log:
  MFC rev. 190519:
  
   Fixup relative pointers after channel realloc. It fixes crash on systems
   with several HDA codecs per controller.
  
   While I am there, remove some unneeded dereferences.
  
  MFCed earlier than it should be so that it can be part of 7.2-BETA1.
  
  PR:		kern/131785
  Submitted by:	Tor Egge <Tor.Egge at cvsup.no.freebsd.org>
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/ath/ath_hal/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/sound/pci/hda/hdac.c

Modified: stable/7/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- stable/7/sys/dev/sound/pci/hda/hdac.c	Mon Mar 30 10:16:49 2009	(r190546)
+++ stable/7/sys/dev/sound/pci/hda/hdac.c	Mon Mar 30 10:18:43 2009	(r190547)
@@ -83,7 +83,7 @@
 
 #include "mixer_if.h"
 
-#define HDA_DRV_TEST_REV	"20090316_0130"
+#define HDA_DRV_TEST_REV	"20090329_0131"
 
 SND_DECLARE_FILE("$FreeBSD$");
 
@@ -5264,7 +5264,7 @@ hdac_audio_bind_as(struct hdac_devinfo *
 		    sizeof(struct hdac_chan) * cnt,
 		    M_HDAC, M_ZERO | M_NOWAIT);
 		if (sc->chans == NULL) {
-			device_printf(devinfo->codec->sc->dev,
+			device_printf(sc->dev,
 			    "Channels memory allocation failed!\n");
 			return;
 		}
@@ -5274,17 +5274,20 @@ hdac_audio_bind_as(struct hdac_devinfo *
 		    M_HDAC, M_ZERO | M_NOWAIT);
 		if (sc->chans == NULL) {
 			sc->num_chans = 0;
-			device_printf(devinfo->codec->sc->dev,
+			device_printf(sc->dev,
 			    "Channels memory allocation failed!\n");
 			return;
 		}
+		/* Fixup relative pointers after realloc */
+		for (j = 0; j < sc->num_chans; j++)
+			sc->chans[j].caps.fmtlist = sc->chans[j].fmtlist;
 	}
 	free = sc->num_chans;
 	sc->num_chans += cnt;
 
 	for (j = free; j < free + cnt; j++) {
-		devinfo->codec->sc->chans[j].devinfo = devinfo;
-		devinfo->codec->sc->chans[j].as = -1;
+		sc->chans[j].devinfo = devinfo;
+		sc->chans[j].as = -1;
 	}
 
 	/* Assign associations in order of their numbers, */
@@ -5293,10 +5296,10 @@ hdac_audio_bind_as(struct hdac_devinfo *
 			continue;
 		
 		as[j].chan = free;
-		devinfo->codec->sc->chans[free].as = j;
-		devinfo->codec->sc->chans[free].dir =
+		sc->chans[free].as = j;
+		sc->chans[free].dir =
 		    (as[j].dir == HDA_CTL_IN) ? PCMDIR_REC : PCMDIR_PLAY;
-		hdac_pcmchannel_setup(&devinfo->codec->sc->chans[free]);
+		hdac_pcmchannel_setup(&sc->chans[free]);
 		free++;
 	}
 }


More information about the svn-src-all mailing list