Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1159124imm; Wed, 20 Jun 2018 12:40:13 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLe9Jq3tg0E0X9vYQ2SglmypFdVK1DBFSK9jF7OPObUU1KTy1yN/F2BBVy2zYf0fTes/tOj X-Received: by 2002:a17:902:7c94:: with SMTP id y20-v6mr303143pll.140.1529523613394; Wed, 20 Jun 2018 12:40:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529523613; cv=none; d=google.com; s=arc-20160816; b=gJx0o+4udLmrLllC4N9tHHNcY2uO6vsUF8rr1PJJVeIx34zD4Lx1ZRE7+oLXQluPP8 rpfy4gCBsykcZlG0BBQtGiL1vvK7L48b9dqqMeS2u2GGP8u7gtQBpXhqBpT6wJeTN9lf n8ul23vZ6s122xhlZVDkb4BWLLA3yI1PZvRP5a2eO2Y6Al2ldSc1ss9+eoQaTj6Ajxf2 tbWV2Fn1ghelD5l8BlJKlvDMfgdbWkXIKzcOLSxfqQEWF9KKLNyb8m6U1idvDBTOA/DH qS3/8qOvCcbTx6M+aLWrzffJS6e8Ga1mzRtfmeSsSU9IqiFGhtsZMQUtVkJWpi+Lvg23 Zi5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=+bGIcXmDE965Tgr4jqeEcUc0dUFmZwxE1NNypNEQe5g=; b=JX5WhDBIGnPqwXCRMizC5BI2Qhy1oo2qyvD3SZh49rXnvFKteAUVsl4azJSp/oxzXu 1KWg7pJByO6hpahBA3BMmGGv91ruvt8vqWySYnRuFqCTc7g8cTV4sxUb3si3AnZaojRv KMfasXMQXoudX94uZQUUlygRkWBCogkgdI5N0pB9uIEuLY2v7YAp72xMyoHQuSKw8FbX 782PFrAw6JMkfjH6stq37We0heS+vOBCLjPDQSTjmHLPD/yzl21MChPZG5lr0uT9qIlp RTm5lImG5iFMSKJNr7Ei/LS2g9rIu/H1FtIEflqqeV1YaoAWfOAiQA2VJGeKLuTwT1f3 7OfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ihBvOxsi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c26-v6si2424821pge.596.2018.06.20.12.39.58; Wed, 20 Jun 2018 12:40:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ihBvOxsi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932800AbeFTTjS (ORCPT + 99 others); Wed, 20 Jun 2018 15:39:18 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:40148 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932154AbeFTTjQ (ORCPT ); Wed, 20 Jun 2018 15:39:16 -0400 Received: by mail-lf0-f67.google.com with SMTP id q11-v6so1046503lfc.7 for ; Wed, 20 Jun 2018 12:39:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=+bGIcXmDE965Tgr4jqeEcUc0dUFmZwxE1NNypNEQe5g=; b=ihBvOxsifkQNJvJS0I/l+HF/5E3AMNv0u5j8H0cVryWpUbT/T1sIm/OZxzKHPylsQ1 8L5blw3k52Kxc7Vwhy667mbsndHzSAFla9L0yVelt8BB9qC9qEw9Um31WOpzsJzIwfko HOHKDlsYCcgFq8fa55S38d+l2Tz1tofXf7gnnis/SL2m/NaYH8zmsxq8/tMG5boK9keg 3hTDL8iqvAeUOQ461DgkH2gkz87u44dQ5eR5ngTtC6nu2D7pVuUSrNRGtDdUiG5ogtqg 7T9OtyaxlE8iye7EVIrtAiOrrPwEQcWK2xkAX2ITjdBKRXK1MUZn5WRIBssKfAnv+DHZ WO1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=+bGIcXmDE965Tgr4jqeEcUc0dUFmZwxE1NNypNEQe5g=; b=DtG93oltVbwCvaHWsWoVE9+ocQWGIyXZeTT0BXEyZ+GjO+IVjkyaMEX/y6yqSL8347 LZLsFEbso8DrniPioBl2nzO2fLcyxYyRyByh/vBZx8S4FYP4tQScN+X4VDAPD78rRkPy NQtCsiOy7Z/ByzRRKynzqT+6fmihMjgT4Hi+Bn4Cyg3uFmXxHV+3+sQnVu+3jzUqA874 ym3V/VAataRa1eA0QCECRETDW7l8CxnZa4foGpRufiV7MvJ6jlqcEDl2YTfsZ79JqPMT GKkeBf+vTXONvWVg9jMDqvZ9/ZbF6NZQtKiAB79ltx6ASGmQfJGJT5ME1cRUvqlRlq6l 5ZYA== X-Gm-Message-State: APt69E2ZrvzBMYc7ZtHDbixopPpHBPXU1CjQZsH1irhce6ac2fKNRPzv LaTjAJeaCIAAqhJ43bWM02Js9M4nJ6bMOnJNdsU= X-Received: by 2002:a19:cd08:: with SMTP id d8-v6mr14598206lfg.41.1529523554848; Wed, 20 Jun 2018 12:39:14 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ab3:1a4e:0:0:0:0:0 with HTTP; Wed, 20 Jun 2018 12:39:14 -0700 (PDT) In-Reply-To: References: <1528704248-33818-1-git-send-email-jiazhouyang09@gmail.com> <520e80a8b8de0f532e8dd3ee15af9efbc748dd9a.camel@linux.intel.com> From: =?UTF-8?Q?=C3=89meric_MASCHINO?= Date: Wed, 20 Jun 2018 21:39:14 +0200 Message-ID: Subject: Re: [PATCH] ALSA: fm801: add error handling for snd_ctl_add To: Takashi Iwai Cc: Andy Shevchenko , jiazhouyang09@gmail.com, alsa-devel@alsa-project.org, BhumikaGoyal , Jaroslav Kysela , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Patch tested on my ia64 workstation. Works flawlessly. Thanks, =C3=89meric 2018-06-11 15:24 GMT+02:00 Takashi Iwai : > On Mon, 11 Jun 2018 10:49:56 +0200, > Andy Shevchenko wrote: >> >> On Mon, 2018-06-11 at 16:04 +0800, jiazhouyang09@gmail.com wrote: >> > When snd_ctl_add fails, the lack of error-handling code may >> > cause unexpected results. >> > >> > This patch adds error-handling code after calling snd_ctl_add. >> > >> >> Acked-by: Andy Shevchenko >> >> Though I can't test this (I have FM-only card). Last person who would >> able to test was =C3=89meric (Cc'ed). > > I applied now as this change is pretty safe. > > > thanks, > > Takashi > >> >> > Signed-off-by: Zhouyang Jia >> > --- >> > sound/pci/fm801.c | 16 ++++++++++++---- >> > 1 file changed, 12 insertions(+), 4 deletions(-) >> > >> > diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c >> > index 73a67bc..e3fb9c6 100644 >> > --- a/sound/pci/fm801.c >> > +++ b/sound/pci/fm801.c >> > @@ -1068,11 +1068,19 @@ static int snd_fm801_mixer(struct fm801 *chip) >> > if ((err =3D snd_ac97_mixer(chip->ac97_bus, &ac97, >> > &chip->ac97_sec)) < 0) >> > return err; >> > } >> > - for (i =3D 0; i < FM801_CONTROLS; i++) >> > - snd_ctl_add(chip->card, >> > snd_ctl_new1(&snd_fm801_controls[i], chip)); >> > + for (i =3D 0; i < FM801_CONTROLS; i++) { >> > + err =3D snd_ctl_add(chip->card, >> > + snd_ctl_new1(&snd_fm801_controls[i], chip)); >> > + if (err < 0) >> > + return err; >> > + } >> > if (chip->multichannel) { >> > - for (i =3D 0; i < FM801_CONTROLS_MULTI; i++) >> > - snd_ctl_add(chip->card, >> > snd_ctl_new1(&snd_fm801_controls_multi[i], chip)); >> > + for (i =3D 0; i < FM801_CONTROLS_MULTI; i++) { >> > + err =3D snd_ctl_add(chip->card, >> > + snd_ctl_new1(&snd_fm801_controls_mult >> > i[i], chip)); >> > + if (err < 0) >> > + return err; >> > + } >> > } >> > return 0; >> > } >> >> -- >> Andy Shevchenko >> Intel Finland Oy >>