[bsp][dm365] reject zero max_hz in SPI setup to avoid divide-by-zero

This commit is contained in:
Zhaoqi Xu authored and Rbb666 committed 2026-11-03 13:11:42 +08:00
1 parent 50693c33a4
commit e12183f7b8
1 file changed
+6
+6
View File
@@ -328,6 +328,12 @@ static int davinci_spi_setup_transfer(struct rt_spi_device *spi,
} else
return -RT_ERROR;
/* the prescaler divides by the requested rate */
if (hz == 0)
{
return -RT_EINVAL;
}
/* Set up SPIFMTn register, unique to this chipselect. */
prescale = davinci_spi_get_prescale(dspi, hz);