diff mbox series

[1/3] spi: lpspi: add NULL check when probe device

Message ID 20190423104649.24483-2-xiaoning.wang@nxp.com (mailing list archive)
State New, archived
Headers show
Series spi: lpspi: SS function related changes | expand

Commit Message

Clark Wang April 23, 2019, 10:46 a.m. UTC
Add a NULL check for device node and lpspi_platform_info when lpspi
device probe.

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

Comments

Fabio Estevam April 23, 2019, 11:14 a.m. UTC | #1
Hi Clark,

On Tue, Apr 23, 2019 at 7:47 AM Clark Wang <xiaoning.wang@nxp.com> wrote:
>
> Add a NULL check for device node and lpspi_platform_info when lpspi
> device probe.

Please explain why you are adding such check.
diff mbox series

Patch

diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c
index d08e9324140e..19040b5ef349 100644
--- a/drivers/spi/spi-fsl-lpspi.c
+++ b/drivers/spi/spi-fsl-lpspi.c
@@ -845,6 +845,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,