Skip to contentSkip to conversation

xen: remove unnecessary condition check before kfree

PATCH In review zhong jiang 2 participants 5 messages Sep 8, 2018 – Sep 10, 2018 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen: remove unnecessary condition check before kfree

kfree has taken null pointer into account. So just remove the condition check before kfree.

---
 drivers/xen/xen-acpi-processor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-acpi-processor.c +1 -1
index fbb9137..7e1d49e 100644
@@ -268,7 +268,7 @@ static int push_pxx_to_hypervisor(struct acpi_processor *_pr)
 		pr_warn("(_PXX): Hypervisor error (%d) for ACPI CPU%u\n",
 			ret, _pr->acpi_id);
 err_free:
-	if (!IS_ERR_OR_NULL(dst_states))
+	if (!IS_ERR(dst_states))
 		kfree(dst_states);
 
 	return ret;
Signature · 1 line
1.7.12.4
maintainer
#1 lore raw
Quoted 13 lines · zhong jiang

kfree has taken null pointer into account. So just remove the condition check before kfree.

---
 drivers/xen/xen-acpi-processor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-acpi-processor.c +0 -0
index fbb9137..7e1d49e 100644

drivers/xen/xen-acpi-processor.c static int push_pxx_to_hypervisor(struct acpi_processor *_pr) · line 271

Quoted 5 lines
drivers/xen/xen-acpi-processor.c +1 -1
@@ -268,7 +268,7 @@ static int push_pxx_to_hypervisor(struct acpi_processor *_pr)
 		pr_warn("(_PXX): Hypervisor error (%d) for ACPI CPU%u\n",
 			ret, _pr->acpi_id);
 err_free:
-	if (!IS_ERR_OR_NULL(dst_states))
+	if (!IS_ERR(dst_states))

This is just a change of the condition, not a removal.

I don't think change is worth it.

Juergen

#2 lore raw
Quoted 21 lines · Juergen Gross
Quoted 13 lines · zhong jiang

kfree has taken null pointer into account. So just remove the condition check before kfree.

---
 drivers/xen/xen-acpi-processor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-acpi-processor.c +0 -0
index fbb9137..7e1d49e 100644

drivers/xen/xen-acpi-processor.c static int push_pxx_to_hypervisor(struct acpi_processor *_pr) · line 271

Quoted 5 lines
drivers/xen/xen-acpi-processor.c +1 -1
@@ -268,7 +268,7 @@ static int push_pxx_to_hypervisor(struct acpi_processor *_pr)
 		pr_warn("(_PXX): Hypervisor error (%d) for ACPI CPU%u\n",
 			ret, _pr->acpi_id);
 err_free:
-	if (!IS_ERR_OR_NULL(dst_states))
+	if (!IS_ERR(dst_states))

This is just a change of the condition, not a removal.

Quoted 2 lines

I don't think change is worth it.

Fine, I just consider the duplication of function. Of course. make sense you have said. Maybe it will more clear to have the judgement.

Thanks,
zhong jiang

Quoted 3 lines

Juergen

#3 lore raw
In reply to Juergen Gross
Quoted 21 lines · Juergen Gross
Quoted 13 lines · zhong jiang

kfree has taken null pointer into account. So just remove the condition check before kfree.

---
 drivers/xen/xen-acpi-processor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-acpi-processor.c +0 -0
index fbb9137..7e1d49e 100644

drivers/xen/xen-acpi-processor.c static int push_pxx_to_hypervisor(struct acpi_processor *_pr) · line 271

Quoted 5 lines
drivers/xen/xen-acpi-processor.c +1 -1
@@ -268,7 +268,7 @@ static int push_pxx_to_hypervisor(struct acpi_processor *_pr)
 		pr_warn("(_PXX): Hypervisor error (%d) for ACPI CPU%u\n",
 			ret, _pr->acpi_id);
 err_free:
-	if (!IS_ERR_OR_NULL(dst_states))
+	if (!IS_ERR(dst_states))

This is just a change of the condition, not a removal.

Quoted 2 lines

I don't think change is worth it.

Fine, I just consider the duplication of function. Of course. make sense you have said. Maybe it will more clear to have the judgement.

Thanks,
zhong jiang

Quoted 3 lines

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

maintainer
#4 lore raw
In reply to zhong jiang
Quoted 13 lines · zhong jiang

kfree has taken null pointer into account. So just remove the condition check before kfree.

---
 drivers/xen/xen-acpi-processor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-acpi-processor.c +0 -0
index fbb9137..7e1d49e 100644

drivers/xen/xen-acpi-processor.c static int push_pxx_to_hypervisor(struct acpi_processor *_pr) · line 271

Quoted 5 lines
drivers/xen/xen-acpi-processor.c +1 -1
@@ -268,7 +268,7 @@ static int push_pxx_to_hypervisor(struct acpi_processor *_pr)
 		pr_warn("(_PXX): Hypervisor error (%d) for ACPI CPU%u\n",
 			ret, _pr->acpi_id);
 err_free:
-	if (!IS_ERR_OR_NULL(dst_states))
+	if (!IS_ERR(dst_states))

This is just a change of the condition, not a removal.

I don't think change is worth it.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel