From patchwork Mon Jul 31 21:42:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 708773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0744DC001DE for ; Mon, 31 Jul 2023 21:48:39 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3BAA4AE9; Mon, 31 Jul 2023 23:47:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3BAA4AE9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1690840117; bh=s/h/nHDpyPDzg5v9orQjSPWTTnDelCpj81jdq4JEjHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=oy8ne440+SwD917vdDKe10QuHWAoD/4X+KHVagP/d1p/YX9APPiEUBStNyI/FQRWc M3oi1/nvaxj2XD2SBJ2ux/BM23tSZQMoSo7ipYtxuWTYNfC0mtg91WTsxDMk8BcmbV Nb0fEfH1FOXep4raa5evW1adoPZlqfDV2hKlptK4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 907DAF80621; Mon, 31 Jul 2023 23:44:09 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D2335F8061F; Mon, 31 Jul 2023 23:44:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2C4A3F805B4; Mon, 31 Jul 2023 23:43:33 +0200 (CEST) Received: from mgamail.intel.com (unknown [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 09830F8055C for ; Mon, 31 Jul 2023 23:43:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 09830F8055C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=b/+9ULOX DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690839801; x=1722375801; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=s/h/nHDpyPDzg5v9orQjSPWTTnDelCpj81jdq4JEjHY=; b=b/+9ULOXU9CYN6Yqhj2lOODEDP31Fu1zL8fRmBrHbxpx39qK/p79a2aV GbjuNZbVzUdupymeaj29NeecP8nTuXVgYXM+0N8XhIA1nShCvu67/CuuS 9WKJC+3R9zUbGwGS4o+ZxSn3N/JuyvHQhn1ce/q3a5FnxEf+e6J3jfndf PJmgQjnl6Fcf7pIMX5ZOV0dQXy5ktif1xF4jwDn1mapTDs7Q8q31FFcZH uJO+9SrY5LYCsM1Imtn6StKbD5oxaN9dW5NwBhu26nWHrCF+7z/gMuxgy LPVL2nAL/GUxTqlYFZk6o1ZkUrtAYiyPF2kt8VLfcy7gEH8Z3PQcxp20Q A==; X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="435449779" X-IronPort-AV: E=Sophos;i="6.01,245,1684825200"; d="scan'208";a="435449779" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 14:43:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="763523552" X-IronPort-AV: E=Sophos;i="6.01,245,1684825200"; d="scan'208";a="763523552" Received: from youngnic-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.209.180.66]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 14:43:15 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Charles Keepax , Bard Liao , Ranjani Sridharan , Rander Wang , Pierre-Louis Bossart Subject: [PATCH 13/23] ASoC: intel: sof_sdw: Simplify find_codec_info_acpi Date: Mon, 31 Jul 2023 16:42:47 -0500 Message-Id: <20230731214257.444605-14-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230731214257.444605-1-pierre-louis.bossart@linux.intel.com> References: <20230731214257.444605-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: DLWWOH5HAVEU6TLYPOX4ZBTJSONYZE64 X-Message-ID-Hash: DLWWOH5HAVEU6TLYPOX4ZBTJSONYZE64 X-MailFrom: pierre-louis.bossart@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Charles Keepax Use a return rather than a break and an additional range check. Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Reviewed-by: Rander Wang Signed-off-by: Charles Keepax Signed-off-by: Pierre-Louis Bossart --- sound/soc/intel/boards/sof_sdw.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 6b55bcdccccc..d3222f40d798 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -1003,14 +1003,10 @@ static inline int find_codec_info_acpi(const u8 *acpi_id) return -EINVAL; for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) - if (!memcmp(codec_info_list[i].acpi_id, acpi_id, - ACPI_ID_LEN)) - break; + if (!memcmp(codec_info_list[i].acpi_id, acpi_id, ACPI_ID_LEN)) + return i; - if (i == ARRAY_SIZE(codec_info_list)) - return -EINVAL; - - return i; + return -EINVAL; } /*