|
From: openocd-gerrit <ope...@us...> - 2025-02-11 11:57:11
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via 82277462b91506a9e7ee4bdcee86d6b414d59149 (commit)
from 7dd875900ec252b5f332298cef3030f67a37150f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 82277462b91506a9e7ee4bdcee86d6b414d59149
Author: Tomas Vanek <va...@fb...>
Date: Mon Feb 3 20:28:49 2025 +0100
drivers/linuxspidev: fix use of uninitialized speed variable
Valgrind reported
== Syscall param ioctl(generic) points to uninitialised byte(s)
== at 0x4ABF990: ioctl (ioctl.S:26)
== by 0x19D00B: spidev_speed (linuxspidev.c:181)
== by 0x19D00B: spidev_init (linuxspidev.c:307)
Indeed, spidev_init() uses adapter_get_speed(), it calls
adapter_khz_to_speed() and it returns early without setting
the output parameter if adapter is not initialized.
Of course the adapter initialized flag is not set until
spidev_init() returns.
Simply drop this code as the adapter infrastructure initializes
adapter speed just after spidev_init() return.
Change-Id: I26f011ae59fc942a34d9bb517f467c22f735091d
Signed-off-by: Tomas Vanek <va...@fb...>
Fixes: 83e0293f7ba3 ("Add Linux SPI device SWD adapter support")
Reviewed-on: https://review.openocd.org/c/openocd/+/8733
Tested-by: jenkins
Reviewed-by: Richard Pasek <rp...@go...>
diff --git a/src/jtag/drivers/linuxspidev.c b/src/jtag/drivers/linuxspidev.c
index 94a0c510a..73d5e8bed 100644
--- a/src/jtag/drivers/linuxspidev.c
+++ b/src/jtag/drivers/linuxspidev.c
@@ -307,18 +307,6 @@ static int spidev_init(void)
LOG_INFO("Opened SPI device at %s in mode 0x%" PRIx32 " with %" PRIu8 " bits ",
spi_path, spi_mode, spi_bits);
- // Set SPI read and write max speed.
- int speed;
- ret = adapter_get_speed(&speed);
- if (ret != ERROR_OK) {
- LOG_ERROR("Failed to get adapter speed");
- return ERROR_JTAG_INIT_FAILED;
- }
-
- ret = spidev_speed(speed);
- if (ret != ERROR_OK)
- return ERROR_JTAG_INIT_FAILED;
-
if (max_queue_entries == 0) {
ret = spidev_alloc_queue(MAX_QUEUE_ENTRIES);
if (ret != ERROR_OK)
-----------------------------------------------------------------------
Summary of changes:
src/jtag/drivers/linuxspidev.c | 12 ------------
1 file changed, 12 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|