[PATCH] spi: Ensure we always have a maximum speed specified somewhere
Mark Brown <[email protected]> Fri, 31 Jul 2026 23:38:55 +0100
| Newsgroups | org.kernel.vger.linux-spi,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Currently all the places where we might specify a maximum transfer speed are optional, adding complexity every time we have to use the value since we have to handle unspecified as a special case. Simplify things for users by providing a default for controlllers that is the maximum representable speed. Signed-off-by: Mark Brown <[email protected]> --- drivers/spi/spi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d9e6b4b87c89..0a13d0bfd218 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -3542,6 +3542,13 @@ int spi_register_controller(struct spi_controller *ctlr) goto del_ctrl; } + /* + * Ensure that there's always *some* limit without us needing + * special cases everywhere. + */ + if (!ctlr->max_speed_hz) + ctlr->max_speed_hz = U32_MAX; + mutex_lock(&board_lock); list_add_tail(&ctlr->list, &spi_controller_list); list_for_each_entry(bi, &board_list, list) --- base-commit: f5098b6bae761e346ebcd9da7f95622c04733cff change-id: 20260731-spi-enforce-max-speed-30c53f183635 Best regards, -- Mark Brown <[email protected]>