linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iommu/omap: Use int type to store negative error codes
@ 2025-08-29 14:02 Qianfeng Rong
  2025-09-02 16:24 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Qianfeng Rong @ 2025-08-29 14:02 UTC (permalink / raw)
  To: Joerg Roedel, Will Deacon, Robin Murphy, iommu, linux-kernel
  Cc: Qianfeng Rong

Change the 'ret' variable from u32 to int to store negative error codes
or zero;

Storing the negative error codes in unsigned type, doesn't cause an issue
at runtime but it's ugly. Additionally, assigning negative error codes to
unsigned type may trigger a GCC warning when the -Wsign-conversion flag
is enabled.

No effect on runtime.

Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
---
 drivers/iommu/omap-iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
index 6fb93927bdb9..5c6f5943f44b 100644
--- a/drivers/iommu/omap-iommu.c
+++ b/drivers/iommu/omap-iommu.c
@@ -1303,8 +1303,8 @@ static int omap_iommu_map(struct iommu_domain *domain, unsigned long da,
 	struct omap_iommu_device *iommu;
 	struct omap_iommu *oiommu;
 	struct iotlb_entry e;
+	int ret = -EINVAL;
 	int omap_pgsz;
-	u32 ret = -EINVAL;
 	int i;
 
 	omap_pgsz = bytes_to_iopgsz(bytes);
-- 
2.34.1


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

* Re: [PATCH] iommu/omap: Use int type to store negative error codes
  2025-08-29 14:02 [PATCH] iommu/omap: Use int type to store negative error codes Qianfeng Rong
@ 2025-09-02 16:24 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2025-09-02 16:24 UTC (permalink / raw)
  To: Qianfeng Rong
  Cc: Joerg Roedel, Will Deacon, Robin Murphy, iommu, linux-kernel

On Fri, Aug 29, 2025 at 10:02:19PM +0800, Qianfeng Rong wrote:
> Change the 'ret' variable from u32 to int to store negative error codes
> or zero;
> 
> Storing the negative error codes in unsigned type, doesn't cause an issue
> at runtime but it's ugly. Additionally, assigning negative error codes to
> unsigned type may trigger a GCC warning when the -Wsign-conversion flag
> is enabled.
> 
> No effect on runtime.
> 
> Signed-off-by: Qianfeng Rong <rongqianfeng@vivo.com>
> ---
>  drivers/iommu/omap-iommu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason

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

end of thread, other threads:[~2025-09-02 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-29 14:02 [PATCH] iommu/omap: Use int type to store negative error codes Qianfeng Rong
2025-09-02 16:24 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).