From patchwork Wed May 22 14:54:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 10956139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78BA713AD for ; Wed, 22 May 2019 15:32:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6905628C0C for ; Wed, 22 May 2019 15:32:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5D39B28C12; Wed, 22 May 2019 15:32:36 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0EBF28C0C for ; Wed, 22 May 2019 15:32:35 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 560C9165F; Wed, 22 May 2019 16:54:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 560C9165F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1558536936; bh=0FVnEp1rTgYARbHu6im0hjlrSXn9tlRwImiS1uFoOxE=; h=Date:From:To:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=jz+hvYHlIEuwOqTIYKRUI/lvHTrum/45LlUxxVNDVdsxyo/TFyiDdDO9LhXDDtInB 3upMkyI7iKmDjcZK1nRiwaokmoaIEec7fj5Q6kmlfLka265LTI/fTt/U99w6DWk8GM 3zrfV/ZRrLk6/OBOeHzEEMoyidrSrjJZSPMgujIg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E3E85F89625; Wed, 22 May 2019 16:54:45 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 332BAF8962F; Wed, 22 May 2019 16:54:45 +0200 (CEST) Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id F1F68F80C20 for ; Wed, 22 May 2019 16:54:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F1F68F80C20 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JRZG+kyP" Received: by mail-qt1-x84a.google.com with SMTP id 28so2257510qtw.5 for ; Wed, 22 May 2019 07:54:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=ntAeSC3tz3fZtB8V8PXV81BhYRh60p3xez9SWg7GxLQ=; b=JRZG+kyP5FzABXlyfcBF9DQAHNO+gN+WpRarq6JVggKCvShuFG+SF4kCkjDU4VDuEf EKCjNczOKpCPWzlIKB3BqCN9V9+AwtIQoJznj/AdEuNMZ69Fh0yUdsSzg3T6eiwfz5RL cAol2EFhAKGg0QvFV+WLjNyuN7mXdpxc7TkDyT2pepZ/6/ZAWmqKjdzyqKfCX56KQNRe z51x8ggk9wXiure8jYM4We5QOH2QZHFb//2blMDmGU/5lsdsd+WL7uuHTEDnWymLzpS/ VIemUwWVtVWNrkJp8I40m3vpz53zBvgB3bhtyrueehpWGppPFXNT6HjLzzlBn2Of0DdH yq9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=ntAeSC3tz3fZtB8V8PXV81BhYRh60p3xez9SWg7GxLQ=; b=oeQfelp9IVwYYSsU//AQD6BQ0jIyUx0iIYYEgGSE42S+hos5lWpwW6o5+fVlruIWQg mh/EC3hM3zsiHMHybTjz2orTosc2tavqWZ9ywvn1WIoIIdYSxHSC6hsnkJ6EfKeFlvfM Dg5oi1StvJ+cGjXFxM8NHk2M9PoZCC0Y7w+VUOisKz6nzcWicEC50nid8F1a8MvNBQpm jaX/jB4SDjYV81PrwVW2XglTAtFLr2EcQOnw9iHFqYDmi60QqmBAiwmN9p2nF1rVhPbn sgNp5+8VLfVOSakpFjouVMBsq09sHXAZRJsm/u4AOljw9jBcX9fsMZRXEuEGWIzB631p BieA== X-Gm-Message-State: APjAAAWKdWxvkjPuHvAluPUC7L8azVqTNxaK1Hp4EIaIlfb33CzeXrjK QdyCo8DpO3FsUgl3gJzwaVw/fO+imShw X-Google-Smtp-Source: APXvYqxmeoFMRYoM61l2k+D6ZmiS+nv8cmVHQXBMoJIyKZrxayUk0o0rO+ALb5z9havrENLidYY1ZXiNnqTY X-Received: by 2002:a37:a894:: with SMTP id r142mr69000094qke.37.1558536881170; Wed, 22 May 2019 07:54:41 -0700 (PDT) Date: Wed, 22 May 2019 22:54:02 +0800 Message-Id: <20190522145402.256102-1-tzungbi@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a-goog From: Tzung-Bi Shih To: broonie@kernel.org Cc: tzungbi@google.com, alsa-devel@alsa-project.org, dgreid@google.com, cychiang@google.com, jiaxin.yu@mediatek.com Subject: [alsa-devel] [PATCH] ASoC: mediatek: mt8183: move card registration to the end of probe X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP mt8183_mt6358_ts3a227_max98357_dev_probe() does not return immediately if devm_snd_soc_register_card() returns fail. As a result, the rest of code still get executed. Two options to fix: 1. add an extra return statement if devm_snd_soc_register_card() returns fail 2. move devm_snd_soc_register_card() to the end of probe Adopt option 2 which is more clear and common. Signed-off-by: Tzung-Bi Shih --- .../soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c index 4e44e5689d6f..1efc7f5d04e4 100644 --- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c @@ -345,7 +345,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) struct device_node *platform_node; struct snd_soc_dai_link *dai_link; struct pinctrl *default_pins; - int ret, i; + int i; card->dev = &pdev->dev; @@ -380,11 +380,6 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) return -EINVAL; } - ret = devm_snd_soc_register_card(&pdev->dev, card); - if (ret) - dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", - __func__, ret); - default_pins = devm_pinctrl_get_select(&pdev->dev, PINCTRL_STATE_DEFAULT); if (IS_ERR(default_pins)) { @@ -393,7 +388,7 @@ mt8183_mt6358_ts3a227_max98357_dev_probe(struct platform_device *pdev) return PTR_ERR(default_pins); } - return ret; + return devm_snd_soc_register_card(&pdev->dev, card); } #ifdef CONFIG_OF