]> git.baikalelectronics.ru Git - uboot.git/commit
spi: ti_qspi: Fix "spi-max-frequency" error path in ti_qspi_ofdata_to_platdata
authorOvidiu Panait <ovidiu.panait@windriver.com>
Sat, 28 Nov 2020 08:11:28 +0000 (10:11 +0200)
committerLokesh Vutla <lokeshvutla@ti.com>
Tue, 12 Jan 2021 04:51:41 +0000 (10:21 +0530)
commite0b445f686af22e1d311e2b0e548a7bb1080d6c2
treeb53015f2ef2528e68b89b1ba0494aff30ab789ff
parenta2caa752fec7c7f3dcf1c1efae501e368272b1ba
spi: ti_qspi: Fix "spi-max-frequency" error path in ti_qspi_ofdata_to_platdata

struct ti_qspi_priv->max_hz is declared as unsigned int, so the following
error path check will always be false, even when "spi-max-frequency"
property is invalid/missing:
  priv->max_hz = fdtdec_get_int(blob, node, "spi-max-frequency", -1);
  if (priv->max_hz < 0) {
    ...
  }

Replace the fdtdec call with dev_read_u32_default() and use 0 as the
default value. Error out if max_hz is zero.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
drivers/spi/ti_qspi.c