From patchwork Mon Apr 17 05:41:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 84005 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1905170vqo; Sun, 16 Apr 2023 22:57:57 -0700 (PDT) X-Google-Smtp-Source: AKy350bkeCWbPYu+twBaGdPaL0n1v6S7VIFAc2pIUBM0FyOJE74MFqR4VJJGA9e+S1KdGmHS5ezq X-Received: by 2002:a05:6a20:e20:b0:eb:e22b:efa6 with SMTP id ej32-20020a056a200e2000b000ebe22befa6mr13071850pzb.51.1681711077564; Sun, 16 Apr 2023 22:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681711077; cv=none; d=google.com; s=arc-20160816; b=d+WXkH6Mwk+yur/GPXUmWB2IiVcdM7t2u+Le2dG4X086iObW30u5d8vFMdJ1iSszzy TnfhJP11aPwIIS5d4B/k4iYafpeH8+f2vmh4ESC7LpIPvATgaC8gi5458SQXr7dT+ra5 VwoEICWm4BUAaahkQtWoOlhERjuB+H5ZSVGC2hsz0oFD48iuoJmSd6s8cO/sl+QaePPU JeNZK0iV8h1g9ly9IhIuqT3b3hP102+CM9k9eu/R/z90Be3JpeZzalf1nRT0Z+kBWgUn RBgfESbfXrmLlftzat6P2mS1BhuRcsf1ziwo2fUFpaIqdZiyMO7LiFyhGJ5pOYK+CiOU CtgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sEYIqrDOhNyLMdiTxKCtoht7+kSYTCD6ktbTcZil0+w=; b=cNuT42+ucoozTt4hv+BiHSQjUKjappJFncg8DKv942LyB8ap1gKg30Oa/8RRyT6V76 prjpw5U9X6G9UBsvPW8UO45TvwK/CC83ehS5c+sYvM1mVigVdLFTx9Zbhg6+c1+xB/FI fHXQmEDjtWbRsrqhrYxzmJSdldRGz2dDDfgvWSwHDHd9bre+m4XSu758leFqj4azqGMo iSDRNSmUlTlt7DWmFkOO7+M8wJZmMSFpThdJQWP/8lwUsw4pYqL826i/5HaLIUZHV+a4 Gj9/uXyTOnbPItbvsKVsV+Rpw1aRCI+NcB9cUd23O6lMei2Trb1lOmqu4d4LbG/3JISW kXXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@orange.fr header.s=t20230301 header.b=h2icvuNG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j185-20020a6255c2000000b0063b72afb4cdsi7261698pfb.5.2023.04.16.22.57.45; Sun, 16 Apr 2023 22:57:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@orange.fr header.s=t20230301 header.b=h2icvuNG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229510AbjDQFl5 (ORCPT + 99 others); Mon, 17 Apr 2023 01:41:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbjDQFlz (ORCPT ); Mon, 17 Apr 2023 01:41:55 -0400 Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88E4B10D2 for ; Sun, 16 Apr 2023 22:41:52 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id oHcbphe3Z7JnhoHcbpmzfe; Mon, 17 Apr 2023 07:41:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orange.fr; s=t20230301; t=1681710110; bh=sEYIqrDOhNyLMdiTxKCtoht7+kSYTCD6ktbTcZil0+w=; h=From:To:Cc:Subject:Date; b=h2icvuNGfnX0QFaJHHSig4FFCB1cMfbshNi5NVWSETKCWjW7O0rhH0azthFF/3hkw axbW6bIUYO+SF1H2FyEhzrK++EBFeXGh6U1SQOD/dY3EqdS6+CxIwDJJEgg9Di0mN2 nGGnN7Sa4doqgnfNtRe1bFDO0odjWP3mAgWSoUdLPLh4bwW+tHW3uOXcHiwtnsgHkD sh4ll6TNiyPjV7s47pFc7seP9HdZvUEhQCZcO01FjlB8gOL4AmMUfxNEFqN7ua3ILT aGp5uz3PPjwfl+aUdL12Mpm7C15qj5BGbINA33NSqMprWi4kabhMLhTQALl7vbqdai xKGyt5f0R1GVA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 17 Apr 2023 07:41:50 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Jaroslav Kysela , Takashi Iwai Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , alsa-devel@alsa-project.org Subject: [PATCH] ALSA: hda/hdmi: Remove some dead code Date: Mon, 17 Apr 2023 07:41:48 +0200 Message-Id: <91a31341f32d493bcc6c4515178ce0755ac1aa70.1681710069.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763401875119146860?= X-GMAIL-MSGID: =?utf-8?q?1763401875119146860?= These snd_BUG_ON() can never trigger, so just remove them to save a few LoC. Signed-off-by: Christophe JAILLET --- This patch is speculative. Maybe the other "if"s should be removed and the error code returned instead. I chose to remove these ones and the corresponding error code, because it seems that it is already handled this way in hdmi_pcm_open(). I don't know the code enough, so it is only my guess. Review with care :) --- sound/pci/hda/patch_hdmi.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 5c6980394dce..ee051bdfaff6 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2104,10 +2104,6 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, goto unlock; } - if (snd_BUG_ON(pin_idx < 0)) { - err = -EINVAL; - goto unlock; - } per_pin = get_pin(spec, pin_idx); /* Verify pin:cvt selections to avoid silent audio after S3. @@ -2199,13 +2195,13 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo, snd_hda_spdif_ctls_unassign(codec, pcm_idx); clear_bit(pcm_idx, &spec->pcm_in_use); pin_idx = hinfo_to_pin_index(codec, hinfo); + /* + * In such a case, return 0 to match the behavior in + * hdmi_pcm_open() + */ if (pin_idx < 0) goto unlock; - if (snd_BUG_ON(pin_idx < 0)) { - err = -EINVAL; - goto unlock; - } per_pin = get_pin(spec, pin_idx); if (spec->dyn_pin_out) {