* [PATCH] firmware: stratix10-svc: Fix IS_ERR() vs NULL check in stratix10_svc_drv_probe()
@ 2022-11-14 2:59 Gaosheng Cui
2022-11-14 7:24 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Gaosheng Cui @ 2022-11-14 2:59 UTC (permalink / raw)
To: dinguyen, richard.gong, gregkh, atull, cuigaosheng1; +Cc: linux-kernel
The svc_create_memory_pool() returns an ERR_PTR() on failure, we should use
IS_ERR() to check the return value, and return it on failure.
Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
---
drivers/firmware/stratix10-svc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
index b4081f4d88a3..64e430c6f14a 100644
--- a/drivers/firmware/stratix10-svc.c
+++ b/drivers/firmware/stratix10-svc.c
@@ -1133,8 +1133,8 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
return ret;
genpool = svc_create_memory_pool(pdev, sh_memory);
- if (!genpool)
- return -ENOMEM;
+ if (IS_ERR(genpool))
+ return PTR_ERR(genpool);
/* allocate service controller and supporting channel */
controller = devm_kzalloc(dev, sizeof(*controller), GFP_KERNEL);
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: stratix10-svc: Fix IS_ERR() vs NULL check in stratix10_svc_drv_probe()
2022-11-14 2:59 [PATCH] firmware: stratix10-svc: Fix IS_ERR() vs NULL check in stratix10_svc_drv_probe() Gaosheng Cui
@ 2022-11-14 7:24 ` Greg KH
2022-11-14 11:11 ` cuigaosheng
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2022-11-14 7:24 UTC (permalink / raw)
To: Gaosheng Cui; +Cc: dinguyen, richard.gong, atull, linux-kernel
On Mon, Nov 14, 2022 at 10:59:21AM +0800, Gaosheng Cui wrote:
> The svc_create_memory_pool() returns an ERR_PTR() on failure, we should use
> IS_ERR() to check the return value, and return it on failure.
How was this found and tested?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: stratix10-svc: Fix IS_ERR() vs NULL check in stratix10_svc_drv_probe()
2022-11-14 7:24 ` Greg KH
@ 2022-11-14 11:11 ` cuigaosheng
2022-11-14 11:33 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: cuigaosheng @ 2022-11-14 11:11 UTC (permalink / raw)
To: Greg KH; +Cc: dinguyen, richard.gong, atull, linux-kernel
> How was this found and tested?
Thanks for taking time to review this patch.
I found this through the cocci script, I made the patch based on the code logic,
but I have not tested it due to the lack of hardware devices.
On 2022/11/14 15:24, Greg KH wrote:
> On Mon, Nov 14, 2022 at 10:59:21AM +0800, Gaosheng Cui wrote:
>> The svc_create_memory_pool() returns an ERR_PTR() on failure, we should use
>> IS_ERR() to check the return value, and return it on failure.
> How was this found and tested?
>
> thanks,
>
> greg k-h
> .
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] firmware: stratix10-svc: Fix IS_ERR() vs NULL check in stratix10_svc_drv_probe()
2022-11-14 11:11 ` cuigaosheng
@ 2022-11-14 11:33 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2022-11-14 11:33 UTC (permalink / raw)
To: cuigaosheng; +Cc: dinguyen, richard.gong, atull, linux-kernel
On Mon, Nov 14, 2022 at 07:11:16PM +0800, cuigaosheng wrote:
> > How was this found and tested?
>
> Thanks for taking time to review this patch.
> I found this through the cocci script, I made the patch based on the code logic,
> but I have not tested it due to the lack of hardware devices.
As per our documentation, you have to explain how stuff like this is
found and tested.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-14 11:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 2:59 [PATCH] firmware: stratix10-svc: Fix IS_ERR() vs NULL check in stratix10_svc_drv_probe() Gaosheng Cui
2022-11-14 7:24 ` Greg KH
2022-11-14 11:11 ` cuigaosheng
2022-11-14 11:33 ` Greg KH
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).