From: Bjorn Andersson <andersson@kernel.org>
To: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
Cc: Srinivas Kandagatla <srini@kernel.org>,
Amol Maheshwari <amahesh@qti.qualcomm.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Thierry Escande <thierry.escande@linaro.org>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] misc: fastrpc: Move prints outside spinlock in fastrpc_cb_probe
Date: Mon, 4 May 2026 13:54:08 -0500 [thread overview]
Message-ID: <afjrOx44kOHmmm66@baldur> (raw)
In-Reply-To: <20260504171701.18164-2-mukesh.ojha@oss.qualcomm.com>
On Mon, May 04, 2026 at 10:47:01PM +0530, Mukesh Ojha wrote:
> dev_err() and dev_info() were called while holding a spinlock with
> IRQs disabled, which is incorrect as printk can be slow and should
> not be called in atomic context.
>
> Move the dev_err() for the FASTRPC_MAX_SESSIONS check to after the
> spinlock is released, and save the return value of of_property_read_u32()
> to print dev_info() after the lock is dropped. Minor variable style
> correction in probe function.
>
Reviewed-by: Bjorn Andersson <andersson@kernel.org>
Regards,
Bjorn
> Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> ---
> Changes in v2:
> - New change.
>
> drivers/misc/fastrpc.c | 11 ++++++-----
> 1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index a1a54453bb7e..d169dea961f0 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -2197,19 +2197,22 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> int i, sessions = 0;
> unsigned long flags;
> - int rc;
> u32 dma_bits;
> + u32 sid = 0;
> + int rc;
>
> cctx = dev_get_drvdata(dev->parent);
> if (!cctx)
> return -EINVAL;
>
> of_property_read_u32(dev->of_node, "qcom,nsessions", &sessions);
> + if (of_property_read_u32(dev->of_node, "reg", &sid))
> + dev_info(dev, "FastRPC Session ID not specified in DT\n");
>
> spin_lock_irqsave(&cctx->lock, flags);
> if (cctx->sesscount >= FASTRPC_MAX_SESSIONS) {
> - dev_err(&pdev->dev, "too many sessions\n");
> spin_unlock_irqrestore(&cctx->lock, flags);
> + dev_err(&pdev->dev, "too many sessions\n");
> return -ENOSPC;
> }
> dma_bits = cctx->soc_data->dma_addr_bits_default;
> @@ -2218,13 +2221,11 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
> sess->valid = true;
> sess->dev = dev;
> dev_set_drvdata(dev, sess);
> + sess->sid = sid;
>
> if (cctx->domain_id == CDSP_DOMAIN_ID)
> dma_bits = cctx->soc_data->dma_addr_bits_cdsp;
>
> - if (of_property_read_u32(dev->of_node, "reg", &sess->sid))
> - dev_info(dev, "FastRPC Session ID not specified in DT\n");
> -
> if (sessions > 0) {
> struct fastrpc_session_ctx *dup_sess;
>
> --
> 2.53.0
>
>
next prev parent reply other threads:[~2026-05-04 18:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-04 17:17 [PATCH v2 1/2] misc: fastrpc: Fix NULL pointer dereference in rpmsg callback Mukesh Ojha
2026-05-04 17:17 ` [PATCH v2 2/2] misc: fastrpc: Move prints outside spinlock in fastrpc_cb_probe Mukesh Ojha
2026-05-04 18:54 ` Bjorn Andersson [this message]
2026-05-04 18:53 ` [PATCH v2 1/2] misc: fastrpc: Fix NULL pointer dereference in rpmsg callback Bjorn Andersson
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=afjrOx44kOHmmm66@baldur \
--to=andersson@kernel.org \
--cc=amahesh@qti.qualcomm.com \
--cc=arnd@arndb.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mukesh.ojha@oss.qualcomm.com \
--cc=srini@kernel.org \
--cc=thierry.escande@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