aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorArd Biesheuvel <[email protected]>2019-06-20 12:36:49 +0000
committerMark Brown <[email protected]>2019-06-24 16:30:34 +0000
commitb28944c6f6d3951f0c8f23f90c83ef741d30bfca (patch)
tree72ca08ad15fe0217c4bc5ea208b0ec15cb2bba8d /drivers/spi/spi.c
parentspi: fix ctrl->num_chipselect constraint (diff)
downloadkernel-b28944c6f6d3951f0c8f23f90c83ef741d30bfca.tar.gz
kernel-b28944c6f6d3951f0c8f23f90c83ef741d30bfca.zip
spi/acpi: avoid spurious matches during slave enumeration
In the new SPI ACPI slave enumeration code, we use the value of lookup.max_speed_khz as a flag to decide whether a match occurred. However, doing so only makes sense if we initialize its value to zero beforehand, or otherwise, random junk from the stack will cause spurious matches. So zero initialize the lookup struct fully, and only set the non-zero members explicitly. Fixes: 4c3c59544f33 ("spi/acpi: enumerate all SPI slaves in the namespace") Cc: Mika Westerberg <[email protected]> Cc: [email protected] Cc: [email protected] Cc: "Rafael J. Wysocki" <[email protected]> Cc: Jarkko Nikula <[email protected]> Cc: [email protected] Cc: Lukas Wunner <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Tested-by: Jarkko Nikula <[email protected]> Acked-by: Mika Westerberg <[email protected]> Signed-off-by: Mark Brown <[email protected]>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 80d2d14f6294..81e4d9f7c0f4 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1953,7 +1953,7 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
{
acpi_handle parent_handle = NULL;
struct list_head resource_list;
- struct acpi_spi_lookup lookup;
+ struct acpi_spi_lookup lookup = {};
struct spi_device *spi;
int ret;
@@ -1962,8 +1962,6 @@ static acpi_status acpi_register_spi_device(struct spi_controller *ctlr,
return AE_OK;
lookup.ctlr = ctlr;
- lookup.mode = 0;
- lookup.bits_per_word = 0;
lookup.irq = -1;
INIT_LIST_HEAD(&resource_list);