mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Wan Jiabing <wanjiabing@vivo.com>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dma-buf: Don't use typeof in va_arg
Date: Fri, 10 Jun 2022 09:24:19 +0200	[thread overview]
Message-ID: <c079243c-9084-b565-2320-20453815c79a@amd.com> (raw)
In-Reply-To: <20220610072019.3075023-1-wanjiabing@vivo.com>

Am 10.06.22 um 09:20 schrieb Wan Jiabing:
> Fix following coccicheck warning:
> ./drivers/dma-buf/st-dma-fence-unwrap.c:75:39-45: ERROR: reference preceded by free on line 70
>
> Use 'struct dma_fence *' instead of 'typeof(*fences)' to avoid this
> warning and also fix other 'typeof(*fences)' to make them consistent.

Well that doesn't looks correct to me.

*fence should be valid at this point, why does coccicheck things it is 
freed?

Regards,
Christian.

>
> Fixes: 0c5064fa8d5a ("dma-buf: cleanup dma_fence_unwrap selftest v2")
> Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
> ---
>   drivers/dma-buf/st-dma-fence-unwrap.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma-buf/st-dma-fence-unwrap.c b/drivers/dma-buf/st-dma-fence-unwrap.c
> index 4105d5ea8dde..1137a6d90b32 100644
> --- a/drivers/dma-buf/st-dma-fence-unwrap.c
> +++ b/drivers/dma-buf/st-dma-fence-unwrap.c
> @@ -56,7 +56,7 @@ static struct dma_fence *mock_array(unsigned int num_fences, ...)
>   
>   	va_start(valist, num_fences);
>   	for (i = 0; i < num_fences; ++i)
> -		fences[i] = va_arg(valist, typeof(*fences));
> +		fences[i] = va_arg(valist, struct dma_fence *);
>   	va_end(valist);
>   
>   	array = dma_fence_array_create(num_fences, fences,
> @@ -72,7 +72,7 @@ static struct dma_fence *mock_array(unsigned int num_fences, ...)
>   error_put:
>   	va_start(valist, num_fences);
>   	for (i = 0; i < num_fences; ++i)
> -		dma_fence_put(va_arg(valist, typeof(*fences)));
> +		dma_fence_put(va_arg(valist, struct dma_fence *));
>   	va_end(valist);
>   	return NULL;
>   }


  reply	other threads:[~2022-06-10  7:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-10  7:20 Wan Jiabing
2022-06-10  7:24 ` Christian König [this message]
2022-06-10  7:52   ` Jiabing Wan
2022-06-10  8:00     ` Christian König

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=c079243c-9084-b565-2320-20453815c79a@amd.com \
    --to=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.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 \
    --cc=wanjiabing@vivo.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®