[PATCH] spi: xilinx_spi: Fix potential null pointer access
Jiajie Chen
c at jia.je
Tue Feb 21 06:22:37 CET 2023
It was incorrectly using an old priv->regs pointer, and may lead to null
pointer access.
Signed-off-by: Jiajie Chen <c at jia.je>
---
drivers/spi/xilinx_spi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 4e9115dafe..e759b66000 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -112,9 +112,7 @@ struct xilinx_spi_priv {
static int xilinx_spi_probe(struct udevice *bus)
{
struct xilinx_spi_priv *priv = dev_get_priv(bus);
- struct xilinx_spi_regs *regs = priv->regs;
-
- priv->regs = (struct xilinx_spi_regs *)dev_read_addr(bus);
+ struct xilinx_spi_regs *regs = priv->regs = (struct xilinx_spi_regs *)dev_read_addr(bus);
priv->fifo_depth = dev_read_u32_default(bus, "fifo-size", 0);
--
2.30.2
More information about the U-Boot
mailing list