amd/iommu: add missing unlock in iommu_read_log
PATCH 1/1 amd/iommu: add missing unlock in iommu_read_log
Reported-by: Coverity
CID: 1458632
--- xen/drivers/passthrough/amd/iommu_init.c | 1 + 1 file changed, 1 insertion(+)
xen/drivers/passthrough/amd/iommu_init.c +1 -0
@@ -338,6 +338,7 @@ static int iommu_read_log(struct amd_iommu *iommu, {AMD_IOMMU_DEBUG ("AMD-Vi: No entry written to %s Log\n" , log == &iommu->event_log ?"Event" :"PPR" ); +spin_unlock (&log->lock);return 0 ; }udelay (1 );
Signature · 7 lines
2.25.0 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 2 lines · Roger Pau Monne
Reported-by: Coverity
CID: 1458632
We tend to use just Coverity-ID: 1458632
Quoted 11 lines
Fixes 709d3ddea2d5e ('AMD/IOMMU: Common the #732/#733 errata handling in iommu_read_log()')Signed-off-by Roger Pau Monné <[email protected]>--- xen/drivers/passthrough/amd/iommu_init.c | 1 + 1 file changed, 1 insertion(+)xen/drivers/passthrough/amd/iommu_init.c +0
-0
xen/drivers/passthrough/amd/iommu_init.c static int iommu_read_log(struct amd_iommu *iommu, · line 341
Quoted 4 lines
xen/drivers/passthrough/amd/iommu_init.c +1
-0@@ -338,6 +338,7 @@ static int iommu_read_log(struct amd_iommu *iommu, {AMD_IOMMU_DEBUG ("AMD-Vi: No entry written to %s Log\n" , log == &iommu->event_log ?"Event" :"PPR" ); +spin_unlock (&log->lock);
A goto out would be cleaner. Can fix up on commit if you're happy?
~Andrew
xen/drivers/passthrough/amd/iommu_init.c static int iommu_read_log(struct amd_iommu *iommu, · line 344
Quoted 3 lines
xen/drivers/passthrough/amd/iommu_init.c +0
-0return 0 ; }udelay (1 );
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 5 lines · Andrew Cooper
Quoted 2 lines · Roger Pau Monne
Reported-by: Coverity
CID: 1458632We tend to use just Coverity-ID: 1458632
Oh, I got confused with FreeBSD usage of CID.
Quoted 7 lines
Quoted 7 lines
Fixes 709d3ddea2d5e ('AMD/IOMMU: Common the #732/#733 errata handling in iommu_read_log()')Signed-off-by Roger Pau Monné <[email protected]>--- xen/drivers/passthrough/amd/iommu_init.c | 1 + 1 file changed, 1 insertion(+)
Quoted 11 lines
xen/drivers/passthrough/amd/iommu_init.c static int iommu_read_log(struct amd_iommu *iommu, · line 341
Quoted 9 lines
xen/drivers/passthrough/amd/iommu_init.c +1
-0@@ -338,6 +338,7 @@ static int iommu_read_log(struct amd_iommu *iommu, {AMD_IOMMU_DEBUG ("AMD-Vi: No entry written to %s Log\n" , log == &iommu->event_log ?"Event" :"PPR" ); +spin_unlock (&log->lock);A goto out would be cleaner. Can fix up on commit if you're happy?
That's fine, I don't have a preference. In such cases where a simple unlock is required I tend to avoid the label as I know Jan prefers avoiding them.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 12 lines · Roger Pau Monné
Quoted 10 lines · Andrew Cooper
xen/drivers/passthrough/amd/iommu_init.c static int iommu_read_log(struct amd_iommu *iommu, · line 341
Quoted 7 lines · Roger Pau Monne
xen/drivers/passthrough/amd/iommu_init.c +1
-0@@ -338,6 +338,7 @@ static int iommu_read_log(struct amd_iommu *iommu, {AMD_IOMMU_DEBUG ("AMD-Vi: No entry written to %s Log\n" , log == &iommu->event_log ?"Event" :"PPR" ); +spin_unlock (&log->lock);A goto out would be cleaner. Can fix up on commit if you're happy?
Quoted 3 lines
That's fine, I don't have a preference. In such cases where a simple unlock is required I tend to avoid the label as I know Jan prefers avoiding them.
I appreciate this, yet I accept others thinking differently. The only case where I outright object to "goto" is if the target simply does "return" or some such. Centralizing unlocking in a single place is acceptable to me, albeit perhaps not preferred.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel