From 2e4fcd02d9094cb77ad433ab5ed218007f8b4132 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Tue, 5 Nov 2024 14:58:13 +0100 Subject: [PATCH] [nrf fromtree] dp: swdp_bitbang: fix missing reset pin error This patch fixes an issue where the reset pin is used even when it's not given. Signed-off-by: Maximilian Deubel (cherry picked from commit 4f85ce6eda93199946277d09bd5220b5eddd997e) --- drivers/dp/swdp_bitbang.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/dp/swdp_bitbang.c b/drivers/dp/swdp_bitbang.c index 7822315ab8e..8dec65b6c10 100644 --- a/drivers/dp/swdp_bitbang.c +++ b/drivers/dp/swdp_bitbang.c @@ -601,9 +601,11 @@ static int sw_port_on(const struct device *dev) return ret; } - ret = gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT_ACTIVE); - if (ret) { - return ret; + if (config->reset.port) { + ret = gpio_pin_configure_dt(&config->reset, GPIO_OUTPUT_ACTIVE); + if (ret) { + return ret; + } } return 0;