Skip to content

spi: dw: Fix duplicate if block in dw_spi_transfer_one#7465

Merged
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
martamomotko:fix-duplicate-if-block
Jun 30, 2026
Merged

spi: dw: Fix duplicate if block in dw_spi_transfer_one#7465
pelwell merged 1 commit into
raspberrypi:rpi-6.18.yfrom
martamomotko:fix-duplicate-if-block

Conversation

@martamomotko

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread drivers/spi/spi-dw-core.c
cfg.tmode = DW_SPI_CTRLR0_TMOD_TO;
}
if (!dws->tx) {
} else if (!dws->tx) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the added else here changes behaviour. Was that intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as Phil stated, I think these are mutually exclusive events

Comment thread drivers/spi/spi-dw-core.c
cfg.tmode = DW_SPI_CTRLR0_TMOD_TO;
}
if (!dws->tx) {
} else if (!dws->tx) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The switch to using an else is actually a change in behaviour - previously it was possible to enter the bodies of both if statements (if neither tx nor rx were set), but that's probably not possible (and certainly not useful) in reality. This way probably makes more sense.

@martamomotko martamomotko force-pushed the fix-duplicate-if-block branch from 8ad364d to 3c1e69b Compare June 30, 2026 15:45
The transmit only and receive only conditions in dw_spi_transfer_one()
are mutually exclusive, so restructure as if/else if and remove the
duplicate check.

Signed-off-by: Marta Momotko <marta.momotko@raspberrypi.com>
@martamomotko martamomotko force-pushed the fix-duplicate-if-block branch from 3c1e69b to aa9cfc8 Compare June 30, 2026 15:56
@pelwell pelwell merged commit 3ccb10b into raspberrypi:rpi-6.18.y Jun 30, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants