* 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
* Re: [PATCH 2/5] spi: lpspi: add NULL check when probe device
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
0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2020-07-21 23:44 UTC (permalink / raw)
To: Clark Wang; +Cc: linux-spi, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
On Tue, Jul 14, 2020 at 03:52:48PM +0800, Clark Wang wrote:
> Add a NULL check for device node and lpspi_platform_info when lpspi
> device probe.
This has build problems, I guess there's been a context change that's
caused issues along with causing the later patches to not apply:
/mnt/kernel/drivers/spi/spi-fsl-lpspi.c: In function 'fsl_lpspi_probe':
/mnt/kernel/drivers/spi/spi-fsl-lpspi.c:824:7: error: 'np' undeclared (first use in this function); did you mean 'up'?
if (!np && !lpspi_platform_info) {
^~
up
/mnt/kernel/drivers/spi/spi-fsl-lpspi.c:824:7: note: each undeclared identifier is reported only once for each function it appears in
/mnt/kernel/drivers/spi/spi-fsl-lpspi.c:824:14: error: 'lpspi_platform_info' undeclared (first use in this function); did you mean 'spi_board_info'?
if (!np && !lpspi_platform_info) {
^~~~~~~~~~~~~~~~~~~
spi_board_info
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ 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).