lkml.org 
[lkml]   [2020]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/5] spi: lpspi: add NULL check when probe device
Date
Add a NULL check for device node and lpspi_platform_info when lpspi
device probe.

Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
---
drivers/spi/spi-fsl-lpspi.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index a1555bbc5e5a..ca43d93adf30 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -841,6 +841,11 @@ static int fsl_lpspi_probe(struct platform_device *pdev)
u32 temp;
bool is_slave;

+ if (!np && !lpspi_platform_info) {
+ dev_err(&pdev->dev, "can't get the platform data\n");
+ return -EINVAL;
+ }
+
is_slave = of_property_read_bool((&pdev->dev)->of_node, "spi-slave");
if (is_slave)
controller = spi_alloc_slave(&pdev->dev,
--
2.17.1
\
 
 \ /
  Last update: 2020-07-14 09:52    [W:0.090 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site