Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3540122rwe; Sun, 16 Apr 2023 22:48:41 -0700 (PDT) X-Google-Smtp-Source: AKy350ZSk3e/zGEuzh332scpmK2nt7nk8QB6OlEyJEA/nisT/eg3RxJpNCc4WUrc85pOYlB6Ms8E X-Received: by 2002:a05:6a20:3423:b0:e7:56ad:5a40 with SMTP id i35-20020a056a20342300b000e756ad5a40mr12496589pzd.36.1681710521030; Sun, 16 Apr 2023 22:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681710521; cv=none; d=google.com; s=arc-20160816; b=V1uYQxR7tuDBD2OnquSRqQ2U74HvEbntQL4kGOsMHWjygd9EB+dx/DBLCNLNqRW1RO 1wsqhiyWokQsekv2wsaqYUZjgcDC2otwyvDDkxN9tqfImqB8ts5oFDsQ8+3XEjZxvkog MUc7UJBEB2stT/mkQUW2IPpJNAbhp6QE6Sd2uiDvqkY69dZj9ogQG1+pJTbxFAWiu1O8 TWQ2VG8uSwkTZVuxN6Ipz5D7NGStCmxH1AwSMT99wAHfNYGQxOgk/BLlclcpLMLoBMcb YBzqoAtqCkRFmLxbXRcYsdMRaLVJRQKsdQys8aSVvG7NNdmRiwRCd/pM/h+umYJ36h8s WZmw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w66-20020a626245000000b0063b6f79bcd3si7413794pfb.363.2023.04.16.22.48.24; Sun, 16 Apr 2023 22:48:41 -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 S229911AbjDQFl4 (ORCPT + 99 others); Mon, 17 Apr 2023 01:41:56 -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 Content-Transfer-Encoding: 8bit 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 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) { -- 2.34.1