lkml.org 
[lkml]   [2020]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] 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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/mailbox/mailbox-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mailbox/mailbox-test.c b/drivers/mailbox/mailbox-test.c
index 4555d678fadda..51640a7999e6b 100644
--- a/drivers/mailbox/mailbox-test.c
+++ b/drivers/mailbox/mailbox-test.c
@@ -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;
--
2.26.2
\
 
 \ /
  Last update: 2020-06-03 12:34    [W:0.042 / U:1.528 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site