All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] dma-mapping: Fix build error unused-value
@ 2022-06-30 12:35 ` Ren Zhijie
  0 siblings, 0 replies; 6+ messages in thread
From: Ren Zhijie via iommu @ 2022-06-30 12:35 UTC (permalink / raw)
  To: hch, m.szyprowski, robin.murphy, mathieu.poirier, mark-pk.tsai
  Cc: iommu, Ren Zhijie, iommu, linux-kernel

If CONFIG_DMA_DECLARE_COHERENT is not set,
make ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- will be failed, like this:

drivers/remoteproc/remoteproc_core.c: In function ‘rproc_rvdev_release’:
./include/linux/dma-map-ops.h:182:42: error: statement with no effect [-Werror=unused-value]
 #define dma_release_coherent_memory(dev) (0)
                                          ^
drivers/remoteproc/remoteproc_core.c:464:2: note: in expansion of macro ‘dma_release_coherent_memory’
  dma_release_coherent_memory(dev);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

The return type of function dma_release_coherent_memory in CONFIG_DMA_DECLARE_COHERENT area is void, so in !CONFIG_DMA_DECLARE_COHERENT area it should neither return any value nor be defined as zero.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: e61c451476e6("dma-mapping: Add dma_release_coherent_memory to DMA API")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
---
 include/linux/dma-map-ops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
index 53db9655efe9..bfffe494356a 100644
--- a/include/linux/dma-map-ops.h
+++ b/include/linux/dma-map-ops.h
@@ -179,10 +179,10 @@ static inline int dma_declare_coherent_memory(struct device *dev,
 	return -ENOSYS;
 }
 
-#define dma_release_coherent_memory(dev) (0)
 #define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0)
 #define dma_release_from_dev_coherent(dev, order, vaddr) (0)
 #define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0)
+static inline void dma_release_coherent_memory(struct device *dev) { }
 #endif /* CONFIG_DMA_DECLARE_COHERENT */
 
 #ifdef CONFIG_DMA_GLOBAL_POOL
-- 
2.17.1

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH -next] dma-mapping: Fix build error unused-value
@ 2022-06-30 12:35 ` Ren Zhijie
  0 siblings, 0 replies; 6+ messages in thread
From: Ren Zhijie @ 2022-06-30 12:35 UTC (permalink / raw)
  To: hch, m.szyprowski, robin.murphy, mathieu.poirier, mark-pk.tsai
  Cc: iommu, iommu, linux-kernel, Ren Zhijie

If CONFIG_DMA_DECLARE_COHERENT is not set,
make ARCH=x86_64 CROSS_COMPILE=x86_64-linux-gnu- will be failed, like this:

drivers/remoteproc/remoteproc_core.c: In function ‘rproc_rvdev_release’:
./include/linux/dma-map-ops.h:182:42: error: statement with no effect [-Werror=unused-value]
 #define dma_release_coherent_memory(dev) (0)
                                          ^
drivers/remoteproc/remoteproc_core.c:464:2: note: in expansion of macro ‘dma_release_coherent_memory’
  dma_release_coherent_memory(dev);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

The return type of function dma_release_coherent_memory in CONFIG_DMA_DECLARE_COHERENT area is void, so in !CONFIG_DMA_DECLARE_COHERENT area it should neither return any value nor be defined as zero.

Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: e61c451476e6("dma-mapping: Add dma_release_coherent_memory to DMA API")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
---
 include/linux/dma-map-ops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h
index 53db9655efe9..bfffe494356a 100644
--- a/include/linux/dma-map-ops.h
+++ b/include/linux/dma-map-ops.h
@@ -179,10 +179,10 @@ static inline int dma_declare_coherent_memory(struct device *dev,
 	return -ENOSYS;
 }
 
-#define dma_release_coherent_memory(dev) (0)
 #define dma_alloc_from_dev_coherent(dev, size, handle, ret) (0)
 #define dma_release_from_dev_coherent(dev, order, vaddr) (0)
 #define dma_mmap_from_dev_coherent(dev, vma, vaddr, order, ret) (0)
+static inline void dma_release_coherent_memory(struct device *dev) { }
 #endif /* CONFIG_DMA_DECLARE_COHERENT */
 
 #ifdef CONFIG_DMA_GLOBAL_POOL
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] dma-mapping: Fix build error unused-value
@ 2022-06-30 14:31   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2022-06-30 14:31 UTC (permalink / raw)
  To: Ren Zhijie
  Cc: mathieu.poirier, iommu, linux-kernel, iommu, robin.murphy, hch,
	mark-pk.tsai

Thanks, this looks good with a minor nit below:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Mathieu, can you pick this up through your tree as that is where the
offending commit was merged through?

> Fixes: e61c451476e6("dma-mapping: Add dma_release_coherent_memory to DMA API")

missing space before the opening brace here.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] dma-mapping: Fix build error unused-value
@ 2022-06-30 14:31   ` Christoph Hellwig
  0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2022-06-30 14:31 UTC (permalink / raw)
  To: Ren Zhijie
  Cc: hch, m.szyprowski, robin.murphy, mathieu.poirier, mark-pk.tsai,
	iommu, iommu, linux-kernel

Thanks, this looks good with a minor nit below:

Reviewed-by: Christoph Hellwig <hch@lst.de>

Mathieu, can you pick this up through your tree as that is where the
offending commit was merged through?

> Fixes: e61c451476e6("dma-mapping: Add dma_release_coherent_memory to DMA API")

missing space before the opening brace here.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] dma-mapping: Fix build error unused-value
@ 2022-07-04 15:53     ` Mathieu Poirier
  0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2022-07-04 15:53 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: iommu, linux-kernel, iommu, Ren Zhijie, robin.murphy,
	mark-pk.tsai

On Thu, Jun 30, 2022 at 04:31:16PM +0200, Christoph Hellwig wrote:
> Thanks, this looks good with a minor nit below:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> Mathieu, can you pick this up through your tree as that is where the
> offending commit was merged through?
> 
> > Fixes: e61c451476e6("dma-mapping: Add dma_release_coherent_memory to DMA API")
>

I fixed the missing space and applied this patch.

Thanks,
Mathieu

> missing space before the opening brace here.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -next] dma-mapping: Fix build error unused-value
@ 2022-07-04 15:53     ` Mathieu Poirier
  0 siblings, 0 replies; 6+ messages in thread
From: Mathieu Poirier @ 2022-07-04 15:53 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Ren Zhijie, m.szyprowski, robin.murphy, mark-pk.tsai, iommu,
	iommu, linux-kernel

On Thu, Jun 30, 2022 at 04:31:16PM +0200, Christoph Hellwig wrote:
> Thanks, this looks good with a minor nit below:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
> Mathieu, can you pick this up through your tree as that is where the
> offending commit was merged through?
> 
> > Fixes: e61c451476e6("dma-mapping: Add dma_release_coherent_memory to DMA API")
>

I fixed the missing space and applied this patch.

Thanks,
Mathieu

> missing space before the opening brace here.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-07-04 15:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-30 12:35 [PATCH -next] dma-mapping: Fix build error unused-value Ren Zhijie via iommu
2022-06-30 12:35 ` Ren Zhijie
2022-06-30 14:31 ` Christoph Hellwig
2022-06-30 14:31   ` Christoph Hellwig
2022-07-04 15:53   ` Mathieu Poirier
2022-07-04 15:53     ` Mathieu Poirier

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.