Skip to contentSkip to conversation

mailbox: mailbox-test: Fix a potential Oops on allocation failure

PATCH In review Dan Carpenter 2 participants 2 messages Jun 3, 2020 – Jun 4, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mailbox: mailbox-test: Fix a potential Oops on allocation failure

The callers are expecting NULL on error so if we return an error pointer it eventually results in an Oops.

Fixes 8ea4484d0c2b ("mailbox: Add generic mechanism for testing Mailbox Controllers")
---
 drivers/mailbox/mailbox-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/mailbox-test.c +1 -1
index 4555d678fadda..51640a7999e6b 100644
@@ -327,7 +327,7 @@ mbox_test_request_channel(struct platform_device *pdev, const char *name)
 
 	client = devm_kzalloc(&pdev->dev, sizeof(*client), GFP_KERNEL);
 	if (!client)
-		return ERR_PTR(-ENOMEM);
+		return NULL;
 
 	client->dev		= &pdev->dev;
 	client->rx_callback	= mbox_test_receive_message;
Signature · 1 line
2.26.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Dan Carpenter

The callers are expecting NULL on error so if we return an error pointer it eventually results in an Oops.

Fixes 8ea4484d0c2b ("mailbox: Add generic mechanism for testing Mailbox Controllers")
---
 drivers/mailbox/mailbox-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog