[PATCH] iommufd/selftest: set varaiable mock_iommu_device storage-class-specifier to static

Tom Rix posted 1 patch 3 years ago
drivers/iommu/iommufd/selftest.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] iommufd/selftest: set varaiable mock_iommu_device storage-class-specifier to static
Posted by Tom Rix 3 years ago
smatch reports
drivers/iommu/iommufd/selftest.c:295:21: warning: symbol
  'mock_iommu_device' was not declared. Should it be static?

This variable is only used in one file so it should be static.
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/iommu/iommufd/selftest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
index 2deda489a934..9d43334e4faf 100644
--- a/drivers/iommu/iommufd/selftest.c
+++ b/drivers/iommu/iommufd/selftest.c
@@ -292,7 +292,7 @@ static const struct iommu_ops mock_ops = {
 		},
 };
 
-struct iommu_device mock_iommu_device = {
+static struct iommu_device mock_iommu_device = {
 	.ops = &mock_ops,
 };
 
-- 
2.27.0
Re: [PATCH] iommufd/selftest: set varaiable mock_iommu_device storage-class-specifier to static
Posted by Jason Gunthorpe 3 years ago
On Mon, Apr 03, 2023 at 08:23:17PM -0400, Tom Rix wrote:
> smatch reports
> drivers/iommu/iommufd/selftest.c:295:21: warning: symbol
>   'mock_iommu_device' was not declared. Should it be static?
> 
> This variable is only used in one file so it should be static.
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
>  drivers/iommu/iommufd/selftest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Thanks, I applied this

Jason