From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Lee Jones <lee.jones@linaro.org>,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] mailbox: mailbox-test: Fix a potential Oops on allocation failure
Date: Wed, 3 Jun 2020 13:33:29 +0300 [thread overview]
Message-ID: <20200603103329.GB1845750@mwanda> (raw)
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
next reply other threads:[~2020-06-03 10:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-03 10:33 Dan Carpenter [this message]
2020-06-04 7:41 ` [PATCH] mailbox: mailbox-test: Fix a potential Oops on allocation failure Lee Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200603103329.GB1845750@mwanda \
--to=dan.carpenter@oracle.com \
--cc=jassisinghbrar@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox