aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Lambert <lambert.quentin@gmail.com>2014-09-07 14:04:28 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-09-24 09:56:43 -0400
commit2f4096e311ef0922c42cbf7bc5df44efb3aff716 (patch)
treee68db0d0bec90d5242feece0d310b630a1e3df51
parent79e50e72986c9fcb06d707ce587cfd24fefa33e3 (diff)
PCI: Remove assignment from complicated "if" conditions
The modifications effectively change the value of len_tmp in the case where the first condition is not met. Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/hotplug/ibmphp_res.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/pci/hotplug/ibmphp_res.c b/drivers/pci/hotplug/ibmphp_res.c
index 2f2fcc8f7f8b..219ba8090a37 100644
--- a/drivers/pci/hotplug/ibmphp_res.c
+++ b/drivers/pci/hotplug/ibmphp_res.c
@@ -1044,7 +1044,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
1044 /* found our range */ 1044 /* found our range */
1045 if (!res_prev) { 1045 if (!res_prev) {
1046 /* first time in the loop */ 1046 /* first time in the loop */
1047 if ((res_cur->start != range->start) && ((len_tmp = res_cur->start - 1 - range->start) >= res->len)) { 1047 len_tmp = res_cur->start - 1 - range->start;
1048
1049 if ((res_cur->start != range->start) && (len_tmp >= res->len)) {
1048 debug ("len_tmp = %x\n", len_tmp); 1050 debug ("len_tmp = %x\n", len_tmp);
1049 1051
1050 if ((len_tmp < len_cur) || (len_cur == 0)) { 1052 if ((len_tmp < len_cur) || (len_cur == 0)) {
@@ -1084,7 +1086,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
1084 } 1086 }
1085 if (!res_cur->next) { 1087 if (!res_cur->next) {
1086 /* last device on the range */ 1088 /* last device on the range */
1087 if ((range->end != res_cur->end) && ((len_tmp = range->end - (res_cur->end + 1)) >= res->len)) { 1089 len_tmp = range->end - (res_cur->end + 1);
1090
1091 if ((range->end != res_cur->end) && (len_tmp >= res->len)) {
1088 debug ("len_tmp = %x\n", len_tmp); 1092 debug ("len_tmp = %x\n", len_tmp);
1089 if ((len_tmp < len_cur) || (len_cur == 0)) { 1093 if ((len_tmp < len_cur) || (len_cur == 0)) {
1090 1094
@@ -1123,8 +1127,9 @@ int ibmphp_check_resource (struct resource_node *res, u8 bridge)
1123 if (res_prev) { 1127 if (res_prev) {
1124 if (res_prev->rangeno != res_cur->rangeno) { 1128 if (res_prev->rangeno != res_cur->rangeno) {
1125 /* 1st device on this range */ 1129 /* 1st device on this range */
1126 if ((res_cur->start != range->start) && 1130 len_tmp = res_cur->start - 1 - range->start;
1127 ((len_tmp = res_cur->start - 1 - range->start) >= res->len)) { 1131
1132 if ((res_cur->start != range->start) && (len_tmp >= res->len)) {
1128 if ((len_tmp < len_cur) || (len_cur == 0)) { 1133 if ((len_tmp < len_cur) || (len_cur == 0)) {
1129 if ((range->start % tmp_divide) == 0) { 1134 if ((range->start % tmp_divide) == 0) {
1130 /* just perfect, starting address is divisible by length */ 1135 /* just perfect, starting address is divisible by length */