Commit 3e181b83a52085a6c44e5b2c738097b8256a4945

Authored by Clark Wang
Committed by Ye Li
1 parent 8dcf878800

LFU-18 fix coverity issue

Use the struct lpspi when it is not a NULL ptr.

Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
(cherry picked from commit 697198f65dba420534e8df1d5443f0b0869cc31f)

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

drivers/spi/fsl_lpspi.c
... ... @@ -298,13 +298,15 @@
298 298 int n_bits;
299 299 int ret = 0;
300 300 u32 blk_size;
301   - struct LPSPI_Type *regs = (struct LPSPI_Type *)lpspi->base;
  301 + struct LPSPI_Type *regs;
302 302 u8 watermark = 0;
303 303 struct udevice *dev = lpspi->dev;
304 304 struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
305 305  
306 306 if (!lpspi)
307 307 return -EINVAL;
  308 +
  309 + regs = (struct LPSPI_Type *)lpspi->base;
308 310  
309 311 ret = fsl_lpspi_check_trans_len(n_bytes, lpspi->wordlen);
310 312 if (ret)