mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 23:27:06 +00:00
ALSA: hda: intel-sdw-acpi: Use u8 type for link index
[ Upstream commit485ddd519f
] 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=1): sound/hda/intel-sdw-acpi.c: In function ‘sdw_intel_acpi_scan’: sound/hda/intel-sdw-acpi.c:34:35: error: ‘-subproperties’ directive output may be truncated writing 14 bytes into a region of size between 7 and 17 [-Werror=format-truncation=] 34 | "mipi-sdw-link-%d-subproperties", i); | ^~~~~~~~~~~~~~ In function ‘is_link_enabled’, inlined from ‘sdw_intel_scan_controller’ at sound/hda/intel-sdw-acpi.c:106:8, inlined from ‘sdw_intel_acpi_scan’ at sound/hda/intel-sdw-acpi.c:180:9: sound/hda/intel-sdw-acpi.c:33:9: note: ‘snprintf’ output between 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: commit6d4ab2e97d
("extrawarn: enable format and stringop overflow warnings in W=1") Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230912162617.29178-1-peter.ujfalusi@linux.intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
df28f6bbc8
commit
daac7df916
1 changed files with 4 additions and 4 deletions
|
@ -23,7 +23,7 @@ static int ctrl_link_mask;
|
||||||
module_param_named(sdw_link_mask, ctrl_link_mask, int, 0444);
|
module_param_named(sdw_link_mask, ctrl_link_mask, int, 0444);
|
||||||
MODULE_PARM_DESC(sdw_link_mask, "Intel link mask (one bit per link)");
|
MODULE_PARM_DESC(sdw_link_mask, "Intel link mask (one bit per link)");
|
||||||
|
|
||||||
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;
|
struct fwnode_handle *link;
|
||||||
char name[32];
|
char name[32];
|
||||||
|
@ -31,7 +31,7 @@ static bool is_link_enabled(struct fwnode_handle *fw_node, int i)
|
||||||
|
|
||||||
/* Find master handle */
|
/* Find master handle */
|
||||||
snprintf(name, sizeof(name),
|
snprintf(name, sizeof(name),
|
||||||
"mipi-sdw-link-%d-subproperties", i);
|
"mipi-sdw-link-%hhu-subproperties", idx);
|
||||||
|
|
||||||
link = fwnode_get_named_child_node(fw_node, name);
|
link = fwnode_get_named_child_node(fw_node, name);
|
||||||
if (!link)
|
if (!link)
|
||||||
|
@ -51,8 +51,8 @@ static int
|
||||||
sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
|
sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
|
||||||
{
|
{
|
||||||
struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle);
|
struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle);
|
||||||
int ret, i;
|
u8 count, i;
|
||||||
u8 count;
|
int ret;
|
||||||
|
|
||||||
if (!adev)
|
if (!adev)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Reference in a new issue