From patchwork Thu Sep 15 15:42:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9334483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 071D360839 for ; Thu, 15 Sep 2016 17:44:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F30B429AC3 for ; Thu, 15 Sep 2016 17:44:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E715329AC7; Thu, 15 Sep 2016 17:44:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB60629AC3 for ; Thu, 15 Sep 2016 17:44:27 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 02870261A5E; Thu, 15 Sep 2016 19:44:25 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 2F419261A5E; Thu, 15 Sep 2016 19:42:08 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6F9F3266D08; Thu, 15 Sep 2016 17:43:00 +0200 (CEST) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.17.24]) by alsa0.perex.cz (Postfix) with ESMTP id 22D8F261A5E for ; Thu, 15 Sep 2016 17:42:54 +0200 (CEST) Received: from wuerfel.lan. ([78.43.20.153]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0MTQ1P-1bcYZE1iRr-00SOJD; Thu, 15 Sep 2016 17:42:47 +0200 From: Arnd Bergmann To: Mark Brown Date: Thu, 15 Sep 2016 17:42:21 +0200 Message-Id: <20160915154238.3004097-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:BsS5qqTuvNFpfMKf0WAt0FpSJ6ojPBDPBZmGRqa5T426D96b2Wx 3nFq/vW1+GRQ4fh5AxY73pPocqXqtvKuHlMGAFnE6prl5rm3qsSBKEJ1eVQgHphejzeFdys 1w1q0NxcrJ6DQIyYtw7k6GfyztpbmQSiFDqniQSXk5HhiE1wR8kxkpHZbVAGzYRnwm2TIVo ifaj/2dsMfKcusYQnaF2A== X-UI-Out-Filterresults: notjunk:1; V01:K0:0LV83xa11/g=:swZJvcso+xZjU18UdXx0kE jcie+oy9f+irhK0LOGd/E1R1K5mRjmoDplzc/fyxOfGm1Sm2cPFp9cmzT7aAFJtmLkOifwE00 IA9ScDpCLiq0B6ZqgSDwBJ/HbEJXrgZ2O5tblkRkD2vb2YKwMAZ+ngYVjqCO1JF66oA/6GFvj TUINj+ES3P/j/QkY/r/ry6eeFeaBQNQ39MUOLgkkhirBPAF+f2vMjWPFAQH8WzDfeH3MxZp9I V/jfnet63TCtURYskgwTutE1bE2XuNJ8xTFdtY5Xas3dpZ0ZHNIdHiGxyXZpIEA8wyFVwdWoj 9vASwwOT5gVLM5b69Ne9P1I+fHXVkLtfQYhR3OxnLA/ZrY2m4H/+I6QxEQ6HQNVgZbiK4VN+B /v2tiLOO0DPgVLfcX5sJclRvcmaT88eTQvOgPqtEljhs+MKjMMpvIPGNZZedy1rO/EBrRS7gk FyHi7cCUh2lyAsPOF/9pJyBzMZ2wuhCLwrKNQ9fSNAtXXkYnvoMVWzW1kIikbw5p0qK3Fdq+C AXYXZjWjiOIiIHJo6Mtk8/oRMX0hX0v3Ko+N4kIqQiKYOwlyc4Jq6TwAlzmlx9TL//U3oPh2S K45oBoRU/NwKQN15AlKurYxfdPS41G97PchFIVaimK0KYhaaawb42C13WYJfUeNoZK1AV02JO 4YVPUP08eqcClYI5W/ZfIUSc/T2Rap0beYBZHv6oCy5dyowCy1M+Si27KxVDnbPdAz1Q= Cc: Oder Chiou , Jack Yu , alsa-devel@alsa-project.org, Arnd Bergmann , linux-kernel@vger.kernel.org, Liam Girdwood , John Lin , Bard Liao Subject: [alsa-devel] [PATCH] ASoC: rt5663: refine error handling X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The newly added rt5663 codec driver introduces a couple of warnings when built with -Wmaybe-uninitialized: codecs/rt5663.c: In function 'rt5663_set_tdm_slot': codecs/rt5663.c:2680:2: error: 'reg' may be used uninitialized in this function [-Werror=maybe-uninitialized] codecs/rt5663.c: In function 'rt5663_set_dai_pll': codecs/rt5663.c:2556:12: error: 'shift' may be used uninitialized in this function [-Werror=maybe-uninitialized] codecs/rt5663.c:2596:2: error: 'mask' may be used uninitialized in this function [-Werror=maybe-uninitialized] We can avoid those warnings by always returning an error from the switch() statements instead of falling through with an uninitialized variable when we hit an unexpected case. Signed-off-by: Arnd Bergmann Fixes: df7c52168ee1 ("ASoC: add rt5663 codec driver") --- sound/soc/codecs/rt5663.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c index 7963a2736a91..8078abcaf728 100644 --- a/sound/soc/codecs/rt5663.c +++ b/sound/soc/codecs/rt5663.c @@ -1831,6 +1831,7 @@ static int rt5663_i2s_use_asrc(struct snd_soc_dapm_widget *source, break; default: dev_err(codec->dev, "Unknown CODEC_TYPE\n"); + return 1; } if (da_asrc_en || ad_asrc_en) @@ -2579,6 +2580,7 @@ static int rt5663_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, break; default: dev_err(codec->dev, "Unknown CODEC_TYPE\n"); + return -EINVAL; } switch (source) { @@ -2674,6 +2676,7 @@ static int rt5663_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, break; default: dev_err(codec->dev, "Unknown CODEC_TYPE\n"); + return -EINVAL; } snd_soc_update_bits(codec, reg, RT5668_TDM_MODE_MASK |