Skip to contentSkip to conversation

iommu: Remove extra NULL check when call strtobool()

PATCH Applied Andy Shevchenko 2 participants 2 messages May 14, 2018 – May 15, 2018 1 message not in the archive IOMMU

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu: Remove extra NULL check when call strtobool()

strtobool() does check for NULL parameter already. No need to repeat.

While here, switch to kstrtobool() and unshadow actual error code (which is still -EINVAL).

No functional change intended.

---
 drivers/iommu/iommu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/iommu/iommu.c +4 -2
index d2aa23202bb9..7f61b142263e 100644
@@ -116,9 +116,11 @@ static void __iommu_detach_group(struct iommu_domain *domain,
 static int __init iommu_set_def_domain_type(char *str)
 {
 	bool pt;
+	int ret;
 
-	if (!str || strtobool(str, &pt))
-		return -EINVAL;
+	ret = kstrtobool(str, &pt);
+	if (ret)
+		return ret;
 
 	iommu_def_domain_type = pt ? IOMMU_DOMAIN_IDENTITY : IOMMU_DOMAIN_DMA;
 	return 0;
Signature · 1 line
2.17.0

A message that is not in the archive (sent off-list or not yet received): 20180514162225.81914-1-andriy.shevchenko-VuQAYsv1563Yd54FQh9/[email protected]