From: Beleswar Prasad Padhi <b-padhi@ti.com>
To: Andrew Davis <afd@ti.com>, <andersson@kernel.org>,
<mathieu.poirier@linaro.org>
Cc: <hnagalla@ti.com>, <u-kumar1@ti.com>, <s-anna@ti.com>,
<linux-remoteproc@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 1/3] remoteproc: k3-r5: Use devm_rproc_alloc() helper
Date: Thu, 8 Aug 2024 10:40:35 +0530 [thread overview]
Message-ID: <b4c405a0-bb35-4408-a356-9e26c6f1d19e@ti.com> (raw)
In-Reply-To: <0bba5293-a55d-4f13-887c-272a54d6e1ca@ti.com>
Hi Andrew,
On 07/08/24 19:07, Andrew Davis wrote:
> On 8/7/24 1:22 AM, Beleswar Padhi wrote:
>> Use the device lifecycle managed allocation function. This helps prevent
>> mistakes like freeing out of order in cleanup functions and forgetting
>> to free on error paths.
>>
>> Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
>> ---
>> drivers/remoteproc/ti_k3_r5_remoteproc.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c
>> b/drivers/remoteproc/ti_k3_r5_remoteproc.c
>> index 39a47540c590..dbcd8840ae8d 100644
>> --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c
>> +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c
>> @@ -1259,8 +1259,8 @@ static int k3_r5_cluster_rproc_init(struct
>> platform_device *pdev)
>> goto out;
>> }
>> - rproc = rproc_alloc(cdev, dev_name(cdev), &k3_r5_rproc_ops,
>> - fw_name, sizeof(*kproc));
>> + rproc = devm_rproc_alloc(cdev, dev_name(cdev),
>> &k3_r5_rproc_ops,
>> + fw_name, sizeof(*kproc));
>> if (!rproc) {
>> ret = -ENOMEM;
>> goto out;
>> @@ -1352,7 +1352,6 @@ static int k3_r5_cluster_rproc_init(struct
>> platform_device *pdev)
>> err_add:
>> k3_r5_reserved_mem_exit(kproc);
>> err_config:
>> - rproc_free(rproc);
>> core->rproc = NULL;
>
> I'd remove this line too, we don't check for NULL later, we check
> core->rproc->status, which will cause a nullptr dereference error
> instead of correctly detecting that the core is "offline".
Thanks for catching this! Will post revision with this change.
>
> Same below.
>
> Andrew
>
>> out:
>> /* undo core0 upon any failures on core1 in split-mode */
>> @@ -1399,7 +1398,6 @@ static void k3_r5_cluster_rproc_exit(void *data)
>> k3_r5_reserved_mem_exit(kproc);
>> - rproc_free(rproc);
>> core->rproc = NULL;
>> }
>> }
next prev parent reply other threads:[~2024-08-08 5:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 6:22 [PATCH v3 0/3] Defer TI's Remoteproc's Probe until Mailbox is Probed Beleswar Padhi
2024-08-07 6:22 ` [PATCH v3 1/3] remoteproc: k3-r5: Use devm_rproc_alloc() helper Beleswar Padhi
2024-08-07 13:37 ` Andrew Davis
2024-08-08 5:10 ` Beleswar Prasad Padhi [this message]
2024-08-07 6:22 ` [PATCH v3 2/3] remoteproc: k3-r5: Acquire mailbox handle during probe routine Beleswar Padhi
2024-08-07 6:22 ` [PATCH v3 3/3] remoteproc: k3-dsp: " Beleswar Padhi
2024-08-07 13:51 ` Andrew Davis
2024-08-08 5:20 ` Beleswar Prasad Padhi
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=b4c405a0-bb35-4408-a356-9e26c6f1d19e@ti.com \
--to=b-padhi@ti.com \
--cc=afd@ti.com \
--cc=andersson@kernel.org \
--cc=hnagalla@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=s-anna@ti.com \
--cc=u-kumar1@ti.com \
/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
all inboxes | Powered by JetHome®