From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: stac92xx_parse_auto_config() can return 0 on error? Date: Tue, 06 Feb 2007 18:00:52 +0100 Message-ID: References: <1170714593.28278.151.camel@localhost> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (cantor.suse.de [195.135.220.2]) by alsa.jcu.cz (ALSA's E-mail Delivery System) with ESMTP id 9D28234A for ; Tue, 6 Feb 2007 18:00:57 +0100 (MET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@lists.sourceforge.net Errors-To: alsa-devel-bounces@lists.sourceforge.net To: Jason Baron Cc: John Linville , alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Tue, 6 Feb 2007 11:53:21 -0500 (EST), Jason Baron wrote: > > > On Tue, 6 Feb 2007, Takashi Iwai wrote: > > > At Mon, 05 Feb 2007 14:29:53 -0800, > > Tobin Davis wrote: > > > > > > On Mon, 2007-02-05 at 16:40 -0500, Jason Baron wrote: > > > > > > hi, > > > > > > I just ran into a RHEL4 U5 beta kernel oops in snd_hda_input_mux_info(), > > > because the 'imux' parameter pointer was NULL. I traced this back to > > > stac92xx_parse_auto_config(), which can return 0, if 'line_outs' is not > > > set, without having initialized the 'input_mux'. > > > > > > The oops does not happen on the upstream kernel on this hardware b/c > > > 'line_outs' was set (additional code has been added since RHEL4 to set > > > it). However, it still appears to me, that if 'line_outs' is not set, we > > > should return an error code, and not 0. > > > > > > thanks, > > > > > > -Jason > > > > > > Try this patch to see if it works with your alsa version. It's a simple patch that > > > adds the error condition, and should be able to be applied to older alsa versions. > > > > > > Summary: add error for undetected line_outs. > > > > > > This adds an error condition to stac92xx_parse_auto_config if line_outs is less than > > > zero. > > > > > > > line_outs won't be negative, so this situation can't happen. > > The problem is that stac92xx_parse_auto_config() returns "0" (which > > means successful) even if line_outs = 0 and thus nothing is > > configured. Simply changing it to return -EINVAL would work. > > > > However, this is no best solution. In the case of patch_realtek.c or > > others, the codec probe routine behaves slightly differently. > > *_parse_auto_config() may return 0 if no ane configuration is found. > > Then it falls back to model=basic. Returning a negative means a fatal > > error to stop. Meanwhile, in the case of sigmatel, there is no > > fallback, so it always stop. > > > > The patch below adds the fallback to model=ref in case that no proper > > auto-config is available. Please give it a try. > > > > > > Takashi > > > > > > ok. thanks. in our backport, we don't have 'STAC_925x_REF' > defined....should we be using 'STAC_REF' instead? Also, the change that > introduced this problem into our 'beta' tree was: > > @@ -855,14 +1137,14 @@ static int stac92xx_parse_auto_config(st > > if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, > NULL)) < 0) > return err; > - if (! spec->autocfg.line_outs && ! spec->autocfg.hp_pin) > + if (! spec->autocfg.line_outs) > return 0; /* can't find valid pin config */ > > > If i revert this single change, i avoid the oops as well.... Could you try the latest ALSA version at first? Debugging different versions at the same time is confusing and another possible cause of bugs. If you need backport, try it later. Takashi ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642