* Re: [PATCH 2/5] spi: lpspi: add NULL check when probe device
@ 2020-07-14 8:48 Markus Elfring
0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-07-14 8:48 UTC (permalink / raw)
To: Clark Wang, linux-spi; +Cc: linux-kernel, Mark Brown
…
> +++ 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;
> + }
…
How do you think about to combine these null pointer checks by the logical
operator “or” instead of “and”?
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 0/5] Some bug fix for lpspi
@ 2020-07-14 7:52 Clark Wang
2020-07-14 7:52 ` [PATCH 2/5] spi: lpspi: add NULL check when probe device Clark Wang
0 siblings, 1 reply; 3+ messages in thread
From: Clark Wang @ 2020-07-14 7:52 UTC (permalink / raw)
To: broonie; +Cc: linux-spi, linux-kernel
Hi,
This series mainly fixes some recently discovered problems about CS for
LPSPI module.
And two patches to improve the reliability of the driver.
Regards,
Clark
Clark Wang (4):
spi: lpspi: fix the imbalance of runtime pm function call
spi: lpspi: add NULL check when probe device
spi: lpspi: fix kernel warning dump when probe fail after calling
spi_register
spi: lpspi: fix using CS discontinuously on i.MX8DXLEVK
Fabrice Goucem (1):
spi: lpspi: handle EPROBE_DEFER when get cs-gpios number
drivers/spi/spi-fsl-lpspi.c | 52 +++++++++++++++++++++++++++++--------
1 file changed, 41 insertions(+), 11 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/5] spi: lpspi: add NULL check when probe device
2020-07-14 7:52 [PATCH 0/5] Some bug fix for lpspi Clark Wang
@ 2020-07-14 7:52 ` Clark Wang
2020-07-21 23:44 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Clark Wang @ 2020-07-14 7:52 UTC (permalink / raw)
To: broonie; +Cc: linux-spi, linux-kernel
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-21 23:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 8:48 [PATCH 2/5] spi: lpspi: add NULL check when probe device Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2020-07-14 7:52 [PATCH 0/5] Some bug fix for lpspi Clark Wang
2020-07-14 7:52 ` [PATCH 2/5] spi: lpspi: add NULL check when probe device Clark Wang
2020-07-21 23:44 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).