From: Zhi Wang <zhiw@nvidia.com>
To: Timur Tabi <ttabi@nvidia.com>,
"nouveau@lists.freedesktop.org" <nouveau@lists.freedesktop.org>
Cc: Surath Mitra <smitra@nvidia.com>,
Ankit Agrawal <ankita@nvidia.com>,
Andy Currid <ACurrid@nvidia.com>,
Kirti Wankhede <kwankhede@nvidia.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"Tarun Gupta (SW-GPU)" <targupta@nvidia.com>,
"dakr@kernel.org" <dakr@kernel.org>,
"zhiwang@kernel.org" <zhiwang@kernel.org>,
Aniket Agashe <aniketa@nvidia.com>,
"daniel@ffwll.ch" <daniel@ffwll.ch>, Neo Jia <cjia@nvidia.com>,
Ben Skeggs <bskeggs@nvidia.com>
Subject: Re: [PATCH v3 10/15] nvkm: refine the variable names in r535_gsp_msg_recv()
Date: Thu, 31 Oct 2024 15:49:35 +0000 [thread overview]
Message-ID: <dae97b53-7ecc-484c-ad34-a5a649145862@nvidia.com> (raw)
In-Reply-To: <c49355ab2b273d074e060671558f6a2bb6009c20.camel@nvidia.com>
On 31/10/2024 16.27, Timur Tabi wrote:
> On Thu, 2024-10-31 at 01:52 -0700, Zhi Wang wrote:
>> @@ -336,59 +336,60 @@ static struct nvfw_gsp_rpc *
>> r535_gsp_msg_recv(struct nvkm_gsp *gsp, int fn, u32 gsp_rpc_len)
>> {
>> struct nvkm_subdev *subdev = &gsp->subdev;
>> - struct nvfw_gsp_rpc *msg;
>> + struct nvfw_gsp_rpc *rpc;
>> int time = 4000000, i;
>> u32 size;
>>
>> retry:
>> - msg = r535_gsp_msgq_wait(gsp, sizeof(*msg), &size, &time);
>> - if (IS_ERR_OR_NULL(msg))
>> - return msg;
>> + rpc = r535_gsp_msgq_wait(gsp, sizeof(*rpc), &size, &time);
>> + if (IS_ERR_OR_NULL(rpc))
>> + return rpc;
>
> I know this change is supposed to be non-functional, but I did notice a
> pattern here.
>
> This function:
>
> rpc = r535_gsp_msgq_wait(gsp, sizeof(*rpc), &size, &time);
> if (IS_ERR_OR_NULL(rpc))
> return rpc;
>
> Function r535_gsp_rpc_poll, which calls this function:
>
> repv = r535_gsp_msg_recv(gsp, fn, 0);
> mutex_unlock(&gsp->cmdq.mutex);
> if (IS_ERR(repv))
> return PTR_ERR(repv);
>
> So if rpc is NULL, r535_gsp_msg_recv() will return NULL, but r535_gsp_rpc_poll
> expects an error code instead. Since it technically doesn't get one, it
> returns 0 (success).
>
> To be fair, it does not appear that r535_gsp_msgq_wait() can return NULL, but
> that is obscured by the code.
>
Nice catch!
It should be fixed in the re-factor in PATCH 12, where
r535_gsp_msgq_wait() always returns an int (error code).
>
next prev parent reply other threads:[~2024-10-31 15:49 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-31 8:52 [PATCH v3 00/15] NVKM GSP RPC kernel docs, cleanups and fixes Zhi Wang
2024-10-31 8:52 ` [PATCH v3 01/15] nvkm: add a kernel doc to introduce the GSP RPC Zhi Wang
2024-12-11 10:14 ` Danilo Krummrich
2024-12-13 14:11 ` Zhi Wang
2024-10-31 8:52 ` [PATCH v3 02/15] nvkm: rename "repc" to "gsp_rpc_len" on the GSP message recv path Zhi Wang
2024-12-11 10:26 ` Danilo Krummrich
2024-12-13 14:12 ` Zhi Wang
2024-10-31 8:52 ` [PATCH v3 03/15] nvkm: rename "argv" to what it represnts on the GSP message send path Zhi Wang
2024-10-31 8:52 ` [PATCH v3 04/15] nvkm: remove unused param repc in *rm_alloc_push() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 05/15] nvkm: rename "argv" to what it represents in *rm_{alloc, ctrl}_*() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 06/15] nvkm: rename "argc" to what it represents in GSP RPC routines Zhi Wang
2024-10-31 8:52 ` [PATCH v3 07/15] nvkm: fix the broken marco GSP_MSG_MAX_SIZE Zhi Wang
2024-10-31 8:52 ` [PATCH v3 08/15] nvkm: remove the magic number in r535_gsp_rpc_push() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 09/15] nvkm: refine the variable names " Zhi Wang
2024-10-31 8:52 ` [PATCH v3 10/15] nvkm: refine the variable names in r535_gsp_msg_recv() Zhi Wang
2024-10-31 14:27 ` Timur Tabi
2024-10-31 15:49 ` Zhi Wang [this message]
2024-10-31 16:11 ` Timur Tabi
2024-10-31 18:18 ` Zhi Wang
2024-10-31 8:52 ` [PATCH v3 11/15] nvkm: rename the variable "cmd" to "msg" in r535_gsp_cmdq_{get, push}() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 12/15] nvkm: factor out r535_gsp_msgq_peek() Zhi Wang
2024-12-11 13:16 ` Danilo Krummrich
2024-10-31 8:52 ` [PATCH v3 13/15] nvkm: factor out r535_gsp_msgq_recv_one_elem() Zhi Wang
2024-10-31 8:52 ` [PATCH v3 14/15] nvkm: support handling the return of large GSP message Zhi Wang
2024-10-31 8:52 ` [PATCH v3 15/15] nvkm: consume " Zhi Wang
2024-10-31 9:05 ` [PATCH v3 00/15] NVKM GSP RPC kernel docs, cleanups and fixes Danilo Krummrich
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=dae97b53-7ecc-484c-ad34-a5a649145862@nvidia.com \
--to=zhiw@nvidia.com \
--cc=ACurrid@nvidia.com \
--cc=airlied@gmail.com \
--cc=aniketa@nvidia.com \
--cc=ankita@nvidia.com \
--cc=bskeggs@nvidia.com \
--cc=cjia@nvidia.com \
--cc=dakr@kernel.org \
--cc=daniel@ffwll.ch \
--cc=kwankhede@nvidia.com \
--cc=nouveau@lists.freedesktop.org \
--cc=smitra@nvidia.com \
--cc=targupta@nvidia.com \
--cc=ttabi@nvidia.com \
--cc=zhiwang@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.