mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
spi: Fix for v6.16
A fix adding missing validation that 8 bit I/O mode is actually supported for the specific device when attempting to use it. Anything that runs into this should already have been having problems, enforcing this should just make things safer and more obvious. -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmh8+nwACgkQJNaLcl1U h9AU4wf8C+H2lO/amMg5UnmWiZeGWznY6UZw2s6TWfj6ogOoxFCauun1pqXI25Lf MmpvD0iVEbHm7yhFJZcfxsQt8mksmrvwfTSrPwA3fruT2opuGe817XuMGqciMhV2 8oVFbiEcGqgeSCPi8r903ZSDIOWvkU43Z36u25I3sILBVGnd1OnWfDDlNZx1yr/2 UZ9roh5Hz3t28hejlwjyJDhqNA7NAEsoby07w+BG+1snH2XfhOimsI/wgamRsga9 9z8DC/S70iZkWWpPLk0QpUQTXJJ9e3h8QIfBLjYilVfUpbpKD0v43G58hFN4XQA1 60ww1oH+t4j01rSdHSn/vzfSysPAuA== =ygcZ -----END PGP SIGNATURE----- Merge tag 'spi-fix-v6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi Pull spi fix from Mark Brown: "A fix adding missing validation that 8 bit I/O mode is actually supported for the specific device when attempting to use it. Anything that runs into this should already have been having problems, enforcing this should just make things safer and more obvious" * tag 'spi-fix-v6.16-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: spi: Add check for 8-bit transfer with 8 IO mode support
This commit is contained in:
commit
990b11a523
|
|
@ -4138,10 +4138,13 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
|
|||
xfer->tx_nbits != SPI_NBITS_OCTAL)
|
||||
return -EINVAL;
|
||||
if ((xfer->tx_nbits == SPI_NBITS_DUAL) &&
|
||||
!(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD)))
|
||||
!(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD | SPI_TX_OCTAL)))
|
||||
return -EINVAL;
|
||||
if ((xfer->tx_nbits == SPI_NBITS_QUAD) &&
|
||||
!(spi->mode & SPI_TX_QUAD))
|
||||
!(spi->mode & (SPI_TX_QUAD | SPI_TX_OCTAL)))
|
||||
return -EINVAL;
|
||||
if ((xfer->tx_nbits == SPI_NBITS_OCTAL) &&
|
||||
!(spi->mode & SPI_TX_OCTAL))
|
||||
return -EINVAL;
|
||||
}
|
||||
/* Check transfer rx_nbits */
|
||||
|
|
@ -4154,10 +4157,13 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
|
|||
xfer->rx_nbits != SPI_NBITS_OCTAL)
|
||||
return -EINVAL;
|
||||
if ((xfer->rx_nbits == SPI_NBITS_DUAL) &&
|
||||
!(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD)))
|
||||
!(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL)))
|
||||
return -EINVAL;
|
||||
if ((xfer->rx_nbits == SPI_NBITS_QUAD) &&
|
||||
!(spi->mode & SPI_RX_QUAD))
|
||||
!(spi->mode & (SPI_RX_QUAD | SPI_RX_OCTAL)))
|
||||
return -EINVAL;
|
||||
if ((xfer->rx_nbits == SPI_NBITS_OCTAL) &&
|
||||
!(spi->mode & SPI_RX_OCTAL))
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user