Skip to content

Commit a2972cb

Browse files
Uwe Kleine-Königjoergroedel
authored andcommitted
iommu/arm-smmu: Drop if with an always false condition
The remove and shutdown callback are only called after probe completed successfully. In this case platform_set_drvdata() was called with a non-NULL argument and so smmu is never NULL. Other functions in this driver also don't check for smmu being non-NULL before using it. Also note that returning an error code from a remove callback doesn't result in the device staying bound. It's still removed and devm allocated resources are freed (among others *smmu and the register mapping). So after an early exit to iommu device stayed around and using it probably oopses. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/20230321084125.337021-2-u.kleine-koenig@pengutronix.de Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent e8d018d commit a2972cb

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

drivers/iommu/arm/arm-smmu/arm-smmu.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,9 +2195,6 @@ static void arm_smmu_device_shutdown(struct platform_device *pdev)
21952195
{
21962196
struct arm_smmu_device *smmu = platform_get_drvdata(pdev);
21972197

2198-
if (!smmu)
2199-
return;
2200-
22012198
if (!bitmap_empty(smmu->context_map, ARM_SMMU_MAX_CBS))
22022199
dev_notice(&pdev->dev, "disabling translation\n");
22032200

@@ -2218,9 +2215,6 @@ static int arm_smmu_device_remove(struct platform_device *pdev)
22182215
{
22192216
struct arm_smmu_device *smmu = platform_get_drvdata(pdev);
22202217

2221-
if (!smmu)
2222-
return -ENODEV;
2223-
22242218
iommu_device_unregister(&smmu->iommu);
22252219
iommu_device_sysfs_remove(&smmu->iommu);
22262220

0 commit comments

Comments
 (0)