diff mbox series

dma-buf: Fix __dma_buf_debugfs_list_del argument for !CONFIG_DEBUG_FS

Message ID 20241117170326.1971113-1-tjmercier@google.com (mailing list archive)
State New
Headers show
Series dma-buf: Fix __dma_buf_debugfs_list_del argument for !CONFIG_DEBUG_FS | expand

Commit Message

T.J. Mercier Nov. 17, 2024, 5:03 p.m. UTC
The arguments for __dma_buf_debugfs_list_del do not match for both the
CONFIG_DEBUG_FS case and the !CONFIG_DEBUG_FS case. The !CONFIG_DEBUG_FS
case should take a struct dma_buf *, but it's currently struct file *.
This can lead to the build error:

error: passing argument 1 of ‘__dma_buf_debugfs_list_del’ from
incompatible pointer type [-Werror=incompatible-pointer-types]

dma-buf.c:63:53: note: expected ‘struct file *’ but argument is of
type ‘struct dma_buf *’
   63 | static void __dma_buf_debugfs_list_del(struct file *file)

Fixes: bfc7bc539392 ("dma-buf: Do not build debugfs related code when !CONFIG_DEBUG_FS")
Signed-off-by: T.J. Mercier <tjmercier@google.com>
---
 drivers/dma-buf/dma-buf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tvrtko Ursulin Nov. 18, 2024, 9:15 a.m. UTC | #1
On 17/11/2024 17:03, T.J. Mercier wrote:
> The arguments for __dma_buf_debugfs_list_del do not match for both the
> CONFIG_DEBUG_FS case and the !CONFIG_DEBUG_FS case. The !CONFIG_DEBUG_FS
> case should take a struct dma_buf *, but it's currently struct file *.
> This can lead to the build error:
> 
> error: passing argument 1 of ‘__dma_buf_debugfs_list_del’ from
> incompatible pointer type [-Werror=incompatible-pointer-types]
> 
> dma-buf.c:63:53: note: expected ‘struct file *’ but argument is of
> type ‘struct dma_buf *’
>     63 | static void __dma_buf_debugfs_list_del(struct file *file)
> 
> Fixes: bfc7bc539392 ("dma-buf: Do not build debugfs related code when !CONFIG_DEBUG_FS")
> Signed-off-by: T.J. Mercier <tjmercier@google.com>
> ---
>   drivers/dma-buf/dma-buf.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> index 8892bc701a66..afb8c1c50107 100644
> --- a/drivers/dma-buf/dma-buf.c
> +++ b/drivers/dma-buf/dma-buf.c
> @@ -60,7 +60,7 @@ static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
>   {
>   }
>   
> -static void __dma_buf_debugfs_list_del(struct file *file)
> +static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf)
>   {
>   }
>   #endif

Huh I wonder how this sneaked by until now.. thanks for fixing!

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>

Regards,

Tvrtko
T.J. Mercier Nov. 18, 2024, 4:13 p.m. UTC | #2
On Mon, Nov 18, 2024 at 1:15 AM Tvrtko Ursulin <tursulin@ursulin.net> wrote:
>
>
> On 17/11/2024 17:03, T.J. Mercier wrote:
> > The arguments for __dma_buf_debugfs_list_del do not match for both the
> > CONFIG_DEBUG_FS case and the !CONFIG_DEBUG_FS case. The !CONFIG_DEBUG_FS
> > case should take a struct dma_buf *, but it's currently struct file *.
> > This can lead to the build error:
> >
> > error: passing argument 1 of ‘__dma_buf_debugfs_list_del’ from
> > incompatible pointer type [-Werror=incompatible-pointer-types]
> >
> > dma-buf.c:63:53: note: expected ‘struct file *’ but argument is of
> > type ‘struct dma_buf *’
> >     63 | static void __dma_buf_debugfs_list_del(struct file *file)
> >
> > Fixes: bfc7bc539392 ("dma-buf: Do not build debugfs related code when !CONFIG_DEBUG_FS")
> > Signed-off-by: T.J. Mercier <tjmercier@google.com>
> > ---
> >   drivers/dma-buf/dma-buf.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
> > index 8892bc701a66..afb8c1c50107 100644
> > --- a/drivers/dma-buf/dma-buf.c
> > +++ b/drivers/dma-buf/dma-buf.c
> > @@ -60,7 +60,7 @@ static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
> >   {
> >   }
> >
> > -static void __dma_buf_debugfs_list_del(struct file *file)
> > +static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf)
> >   {
> >   }
> >   #endif
>
> Huh I wonder how this sneaked by until now.. thanks for fixing!
>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
>
> Regards,
>
> Tvrtko

Thanks Tvrtko. Upstream there is currently only the one use where it's
called with a void pointer which doesn't generate the error, but
KernelCI caught the problem on an Android branch where it's also
called with a dma_buf pointer:

https://dashboard.kernelci.org/tree/5a4c93e2f794001a5efa13c0dec931235240d384/build/maestro:6737e60d1a48e7821930345d?tableFilter=%7B%22buildsTable%22%3A%22invalid%22%2C%22bootsTable%22%3A%22all%22%2C%22testsTable%22%3A%22all%22%7D&origin=maestro&currentPageTab=treeDetails.builds&diffFilter=%7B%7D&treeInfo=%7B%22gitBranch%22%3A%22android16-6.12%22%2C%22gitUrl%22%3A%22https%3A%2F%2Fandroid.googlesource.com%2Fkernel%2Fcommon%22%2C%22treeName%22%3A%22android%22%2C%22commitName%22%3A%22ASB-2024-11-05_16-6.12-370-g5a4c93e2f7940%22%2C%22headCommitHash%22%3A%225a4c93e2f794001a5efa13c0dec931235240d384%22%7D&intervalInDays=7
diff mbox series

Patch

diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c
index 8892bc701a66..afb8c1c50107 100644
--- a/drivers/dma-buf/dma-buf.c
+++ b/drivers/dma-buf/dma-buf.c
@@ -60,7 +60,7 @@  static void __dma_buf_debugfs_list_add(struct dma_buf *dmabuf)
 {
 }
 
-static void __dma_buf_debugfs_list_del(struct file *file)
+static void __dma_buf_debugfs_list_del(struct dma_buf *dmabuf)
 {
 }
 #endif