Skip to contentSkip to conversation

spi: lpspi: add NULL check when probe device

PATCH Markus Elfring 1 participant 1 message Jul 14, 2020 SPI

lore
Share & tools
lore
#0 lore raw

…

Review static int fsl_lpspi_probe(struct platform_device *pdev) · line 847

Quoted 9 lines

+++ b/drivers/spi/spi-fsl-lpspi.c

(quoted diff) +4 -0
@@ -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;
+	}

…

How do you think about to combine these null pointer checks by the logical operator “or” instead of “and”?

Regards,
Markus