mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-11-16 01:05:15 +08:00
[bsp][dm365] reject zero max_hz in SPI setup to avoid divide-by-zero
This commit is contained in:
1 parent
50693c33a4
commit
e12183f7b8
1 file changed
+6
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user