drivers/spi/spi-tegra20-sflash.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
Replace lock/unlock pattern with guard cleanup macro.
This simplifies the code flow path by replacing the conditional
jump with an early return.
Generated-by: Coccinelle SmPL
Signed-off-by: Erick Karanja <karanja99erick@gmail.com>
---
drivers/spi/spi-tegra20-sflash.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-tegra20-sflash.c b/drivers/spi/spi-tegra20-sflash.c
index d5c8ee20b8e5..5367aee56545 100644
--- a/drivers/spi/spi-tegra20-sflash.c
+++ b/drivers/spi/spi-tegra20-sflash.c
@@ -359,7 +359,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_sflash_data *tsd)
{
struct spi_transfer *t = tsd->curr_xfer;
- spin_lock(&tsd->lock);
+ guard(spinlock)(&tsd->lock);
if (tsd->tx_status || tsd->rx_status || (tsd->status_reg & SPI_BSY)) {
dev_err(tsd->dev,
"CpuXfer ERROR bit set 0x%x\n", tsd->status_reg);
@@ -370,7 +370,7 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_sflash_data *tsd)
udelay(2);
reset_control_deassert(tsd->rst);
complete(&tsd->xfer_completion);
- goto exit;
+ return IRQ_HANDLED;
}
if (tsd->cur_direction & DATA_DIR_RX)
@@ -383,13 +383,11 @@ static irqreturn_t handle_cpu_based_xfer(struct tegra_sflash_data *tsd)
if (tsd->cur_pos == t->len) {
complete(&tsd->xfer_completion);
- goto exit;
+ return IRQ_HANDLED;
}
tegra_sflash_calculate_curr_xfer_param(tsd->cur_spi, tsd, t);
tegra_sflash_start_cpu_based_transfer(tsd, t);
-exit:
- spin_unlock(&tsd->lock);
return IRQ_HANDLED;
}
--
2.43.0
On Thu, Sep 11, 2025 at 12:35:37AM +0300, Erick Karanja wrote: > Replace lock/unlock pattern with guard cleanup macro. > This simplifies the code flow path by replacing the conditional > jump with an early return. Seriously, please fix your subject lines to follow the style for the subsystem and distinguish between the patches.
© 2016 - 2025 Red Hat, Inc.