From nobody Fri Dec 19 04:51:16 2025 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E507CA0EF1 for ; Tue, 12 Sep 2023 16:26:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236648AbjILQ0W (ORCPT ); Tue, 12 Sep 2023 12:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236761AbjILQ0U (ORCPT ); Tue, 12 Sep 2023 12:26:20 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2144F1 for ; Tue, 12 Sep 2023 09:26:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1694535976; x=1726071976; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=8ltZ1RAODhf+ZyZGueAkDu0r0heKXiDqd7lSxiNg+s0=; b=M+qpAvvBQAnlVmGZECc6WAPa0tBdfmhjMXsVmwgwSZH/WBX19Qi/TDQl sru8ZW0bHEwAhclSkHzddNiCrPWwlWcRWQuXu/208TXYR6sjLMadli1KD +kicjMCJKPsLQPcOWasiN5e7IVdMCedqv9IdwF+dsXbFJnfsE2oTPc+56 1pKsgZkwl94/H2dk3QzonvUMmOiQQsjQ7ewIzEWxaEXsxhuZaifktj4wT 4H0v5LSRBfHfMgbnOePcljOUVZQVnZZZ6Q1KswjRekqohJ1pNfxd1Q6Ib GI3BuzFfhMtmxrkz544GIRXKiIo9ub+cCb4/absuq2pTZIcI9zgLaNwnh g==; X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="357860025" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="357860025" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 09:26:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10831"; a="737173950" X-IronPort-AV: E=Sophos;i="6.02,139,1688454000"; d="scan'208";a="737173950" Received: from zmoussao-mobl1.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.37.58]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2023 09:26:13 -0700 From: Peter Ujfalusi To: tiwai@suse.com, perex@perex.cz, arnd@arndb.de Cc: masahiroy@kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, pierre-louis.bossart@linux.intel.com Subject: [PATCH] ALSA: hda: intel-sdw-acpi: Use u8 type for link index Date: Tue, 12 Sep 2023 19:26:17 +0300 Message-ID: <20230912162617.29178-1-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use consistently u8 for sdw link index. The id is limited to 4, u8 is adequate in size to store it. This change will also fixes the following compiler warning/error (W=3D1): sound/hda/intel-sdw-acpi.c: In function =E2=80=98sdw_intel_acpi_scan=E2=80= =99: sound/hda/intel-sdw-acpi.c:34:35: error: =E2=80=98-subproperties=E2=80=99 d= irective output may be truncated writing 14 bytes into a region of size bet= ween 7 and 17 [-Werror=3Dformat-truncation=3D] 34 | "mipi-sdw-link-%d-subproperties", i); | ^~~~~~~~~~~~~~ In function =E2=80=98is_link_enabled=E2=80=99, inlined from =E2=80=98sdw_intel_scan_controller=E2=80=99 at sound/hda/i= ntel-sdw-acpi.c:106:8, inlined from =E2=80=98sdw_intel_acpi_scan=E2=80=99 at sound/hda/intel-s= dw-acpi.c:180:9: sound/hda/intel-sdw-acpi.c:33:9: note: =E2=80=98snprintf=E2=80=99 output be= tween 30 and 40 bytes into a destination of size 32 33 | snprintf(name, sizeof(name), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 34 | "mipi-sdw-link-%d-subproperties", i); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors The warnings got brought to light by a recent patch upstream: commit 6d4ab2e97dcf ("extrawarn: enable format and stringop overflow warnin= gs in W=3D1") Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart --- sound/hda/intel-sdw-acpi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/hda/intel-sdw-acpi.c b/sound/hda/intel-sdw-acpi.c index 5cb92f7ccbca..b57d72ea4503 100644 --- a/sound/hda/intel-sdw-acpi.c +++ b/sound/hda/intel-sdw-acpi.c @@ -23,7 +23,7 @@ static int ctrl_link_mask; module_param_named(sdw_link_mask, ctrl_link_mask, int, 0444); MODULE_PARM_DESC(sdw_link_mask, "Intel link mask (one bit per link)"); =20 -static bool is_link_enabled(struct fwnode_handle *fw_node, int i) +static bool is_link_enabled(struct fwnode_handle *fw_node, u8 idx) { struct fwnode_handle *link; char name[32]; @@ -31,7 +31,7 @@ static bool is_link_enabled(struct fwnode_handle *fw_node= , int i) =20 /* Find master handle */ snprintf(name, sizeof(name), - "mipi-sdw-link-%d-subproperties", i); + "mipi-sdw-link-%hhu-subproperties", idx); =20 link =3D fwnode_get_named_child_node(fw_node, name); if (!link) @@ -51,8 +51,8 @@ static int sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) { struct acpi_device *adev =3D acpi_fetch_acpi_dev(info->handle); - int ret, i; - u8 count; + u8 count, i; + int ret; =20 if (!adev) return -EINVAL; --=20 2.42.0