From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
To: arnd@arndb.de, gregkh@linuxfoundation.org,
sumit.semwal@linaro.org, christian.koenig@amd.com
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
Jiasheng Jiang <jiasheng@iscas.ac.cn>
Subject: [PATCH] misc: fastrpc: Check for error num after setting mask
Date: Thu, 6 Jan 2022 10:32:34 +0800 [thread overview]
Message-ID: <20220106023234.2550800-1-jiasheng@iscas.ac.cn> (raw)
Because of the possible failure of the dma_supported(), the
dma_set_mask_and_coherent() may return error num.
Therefore, it should be better to check it and return the error if
fails.
Fixes: f6f9279f2bf0 ("misc: fastrpc: Add Qualcomm fastrpc basic driver model")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
---
drivers/misc/fastrpc.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index beda610e6b30..dd1c4a75bb1d 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1644,7 +1644,12 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
kref_init(&data->refcount);
dev_set_drvdata(&rpdev->dev, data);
- dma_set_mask_and_coherent(rdev, DMA_BIT_MASK(32));
+ err = dma_set_mask_and_coherent(rdev, DMA_BIT_MASK(32));
+ if (err) {
+ kfree(data);
+ return err;
+ }
+
INIT_LIST_HEAD(&data->users);
spin_lock_init(&data->lock);
idr_init(&data->ctx_idr);
--
2.25.1
reply other threads:[~2022-01-06 2:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220106023234.2550800-1-jiasheng@iscas.ac.cn \
--to=jiasheng@iscas.ac.cn \
--cc=arnd@arndb.de \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sumit.semwal@linaro.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;
as well as URLs for NNTP newsgroup(s).