diff mbox series

dmaengine: idxd: Fix missing error code in idxd_cdev_open()

Message ID 1622628446-87909-1-git-send-email-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Accepted
Commit 99b18e88a1cf737ae924123d63b46d9a3d17b1af
Headers show
Series dmaengine: idxd: Fix missing error code in idxd_cdev_open() | expand

Commit Message

Jiapeng Chong June 2, 2021, 10:07 a.m. UTC
The error code is missing in this code scenario, add the error code
'-EINVAL' to the return value 'rc'.

Eliminate the follow smatch warning:

drivers/dma/idxd/cdev.c:113 idxd_cdev_open() warn: missing error code
'rc'.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/dma/idxd/cdev.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Dave Jiang June 2, 2021, 3 p.m. UTC | #1
On 6/2/2021 3:07 AM, Jiapeng Chong wrote:
> The error code is missing in this code scenario, add the error code
> '-EINVAL' to the return value 'rc'.
>
> Eliminate the follow smatch warning:
>
> drivers/dma/idxd/cdev.c:113 idxd_cdev_open() warn: missing error code
> 'rc'.
>
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

Acked-by: Dave Jiang <dave.jiang@intel.com>


> ---
>   drivers/dma/idxd/cdev.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
> index 302cba5..d4419bf 100644
> --- a/drivers/dma/idxd/cdev.c
> +++ b/drivers/dma/idxd/cdev.c
> @@ -110,6 +110,7 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp)
>   		pasid = iommu_sva_get_pasid(sva);
>   		if (pasid == IOMMU_PASID_INVALID) {
>   			iommu_sva_unbind_device(sva);
> +			rc = -EINVAL;
>   			goto failed;
>   		}
>
Vinod Koul June 3, 2021, 6:59 a.m. UTC | #2
On 02-06-21, 18:07, Jiapeng Chong wrote:
> The error code is missing in this code scenario, add the error code
> '-EINVAL' to the return value 'rc'.
> 
> Eliminate the follow smatch warning:
> 
> drivers/dma/idxd/cdev.c:113 idxd_cdev_open() warn: missing error code
> 'rc'.

Applied, thanks
diff mbox series

Patch

diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
index 302cba5..d4419bf 100644
--- a/drivers/dma/idxd/cdev.c
+++ b/drivers/dma/idxd/cdev.c
@@ -110,6 +110,7 @@  static int idxd_cdev_open(struct inode *inode, struct file *filp)
 		pasid = iommu_sva_get_pasid(sva);
 		if (pasid == IOMMU_PASID_INVALID) {
 			iommu_sva_unbind_device(sva);
+			rc = -EINVAL;
 			goto failed;
 		}