drivers/iommu/intel/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
dev_iommu_priv_get() is being used at the top of this function which
dereferences dev. Dev cannot be NULL after this. Remove the validity
check on dev and simplify the code.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
drivers/iommu/intel/iommu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index df5c62ecf942b..f79edbbd651a4 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -2502,7 +2502,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
}
}
- if (dev && domain_context_mapping(domain, dev)) {
+ if (domain_context_mapping(domain, dev)) {
dev_err(dev, "Domain context map failed\n");
dmar_remove_one_dev_info(dev);
return NULL;
--
2.30.2
Any thoughts?
On 3/13/22 8:03 PM, Muhammad Usama Anjum wrote:
> dev_iommu_priv_get() is being used at the top of this function which
> dereferences dev. Dev cannot be NULL after this. Remove the validity
> check on dev and simplify the code.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> drivers/iommu/intel/iommu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index df5c62ecf942b..f79edbbd651a4 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -2502,7 +2502,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
> }
> }
>
> - if (dev && domain_context_mapping(domain, dev)) {
> + if (domain_context_mapping(domain, dev)) {
> dev_err(dev, "Domain context map failed\n");
> dmar_remove_one_dev_info(dev);
> return NULL;
--
Muhammad Usama Anjum
On 2022/4/4 15:52, Muhammad Usama Anjum wrote:
> Any thoughts?
It looks good to me. I will queue it for v5.19.
Best regards,
baolu
>
> On 3/13/22 8:03 PM, Muhammad Usama Anjum wrote:
>> dev_iommu_priv_get() is being used at the top of this function which
>> dereferences dev. Dev cannot be NULL after this. Remove the validity
>> check on dev and simplify the code.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>> ---
>> drivers/iommu/intel/iommu.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>> index df5c62ecf942b..f79edbbd651a4 100644
>> --- a/drivers/iommu/intel/iommu.c
>> +++ b/drivers/iommu/intel/iommu.c
>> @@ -2502,7 +2502,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
>> }
>> }
>>
>> - if (dev && domain_context_mapping(domain, dev)) {
>> + if (domain_context_mapping(domain, dev)) {
>> dev_err(dev, "Domain context map failed\n");
>> dmar_remove_one_dev_info(dev);
>> return NULL;
>
© 2016 - 2026 Red Hat, Inc.