diff options
| author | Jan Beulich <JBeulich@suse.com> | 2016-07-06 03:00:14 -0400 |
|---|---|---|
| committer | David Vrabel <david.vrabel@citrix.com> | 2016-07-06 05:35:38 -0400 |
| commit | 1ad6344acfbf19288573b4a5fa0b07cbb5af27d7 (patch) | |
| tree | c00b645b88f13d38abb971978afa9531b3352a16 /drivers/xen | |
| parent | ee87d6d0d36d98c550f99274a81841033226e3bf (diff) | |
xen-pciback: drop superfluous variables
req_start is simply an alias of the "offset" function parameter, and
req_end is being used just once in each function. (And both variables
were loop invariant anyway, so should at least have got initialized
outside the loop.)
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/xen')
| -rw-r--r-- | drivers/xen/xen-pciback/conf_space.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/xen/xen-pciback/conf_space.c b/drivers/xen/xen-pciback/conf_space.c index 6855bf552126..9e9286d0872e 100644 --- a/drivers/xen/xen-pciback/conf_space.c +++ b/drivers/xen/xen-pciback/conf_space.c | |||
| @@ -148,7 +148,7 @@ int xen_pcibk_config_read(struct pci_dev *dev, int offset, int size, | |||
| 148 | struct xen_pcibk_dev_data *dev_data = pci_get_drvdata(dev); | 148 | struct xen_pcibk_dev_data *dev_data = pci_get_drvdata(dev); |
| 149 | const struct config_field_entry *cfg_entry; | 149 | const struct config_field_entry *cfg_entry; |
| 150 | const struct config_field *field; | 150 | const struct config_field *field; |
| 151 | int req_start, req_end, field_start, field_end; | 151 | int field_start, field_end; |
| 152 | /* if read fails for any reason, return 0 | 152 | /* if read fails for any reason, return 0 |
| 153 | * (as if device didn't respond) */ | 153 | * (as if device didn't respond) */ |
| 154 | u32 value = 0, tmp_val; | 154 | u32 value = 0, tmp_val; |
| @@ -178,12 +178,10 @@ int xen_pcibk_config_read(struct pci_dev *dev, int offset, int size, | |||
| 178 | list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { | 178 | list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { |
| 179 | field = cfg_entry->field; | 179 | field = cfg_entry->field; |
| 180 | 180 | ||
| 181 | req_start = offset; | ||
| 182 | req_end = offset + size; | ||
| 183 | field_start = OFFSET(cfg_entry); | 181 | field_start = OFFSET(cfg_entry); |
| 184 | field_end = OFFSET(cfg_entry) + field->size; | 182 | field_end = OFFSET(cfg_entry) + field->size; |
| 185 | 183 | ||
| 186 | if (req_end > field_start && field_end > req_start) { | 184 | if (offset + size > field_start && field_end > offset) { |
| 187 | err = conf_space_read(dev, cfg_entry, field_start, | 185 | err = conf_space_read(dev, cfg_entry, field_start, |
| 188 | &tmp_val); | 186 | &tmp_val); |
| 189 | if (err) | 187 | if (err) |
| @@ -191,7 +189,7 @@ int xen_pcibk_config_read(struct pci_dev *dev, int offset, int size, | |||
| 191 | 189 | ||
| 192 | value = merge_value(value, tmp_val, | 190 | value = merge_value(value, tmp_val, |
| 193 | get_mask(field->size), | 191 | get_mask(field->size), |
| 194 | field_start - req_start); | 192 | field_start - offset); |
| 195 | } | 193 | } |
| 196 | } | 194 | } |
| 197 | 195 | ||
| @@ -211,7 +209,7 @@ int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) | |||
| 211 | const struct config_field_entry *cfg_entry; | 209 | const struct config_field_entry *cfg_entry; |
| 212 | const struct config_field *field; | 210 | const struct config_field *field; |
| 213 | u32 tmp_val; | 211 | u32 tmp_val; |
| 214 | int req_start, req_end, field_start, field_end; | 212 | int field_start, field_end; |
| 215 | 213 | ||
| 216 | if (unlikely(verbose_request)) | 214 | if (unlikely(verbose_request)) |
| 217 | printk(KERN_DEBUG | 215 | printk(KERN_DEBUG |
| @@ -224,19 +222,17 @@ int xen_pcibk_config_write(struct pci_dev *dev, int offset, int size, u32 value) | |||
| 224 | list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { | 222 | list_for_each_entry(cfg_entry, &dev_data->config_fields, list) { |
| 225 | field = cfg_entry->field; | 223 | field = cfg_entry->field; |
| 226 | 224 | ||
| 227 | req_start = offset; | ||
| 228 | req_end = offset + size; | ||
| 229 | field_start = OFFSET(cfg_entry); | 225 | field_start = OFFSET(cfg_entry); |
| 230 | field_end = OFFSET(cfg_entry) + field->size; | 226 | field_end = OFFSET(cfg_entry) + field->size; |
| 231 | 227 | ||
| 232 | if (req_end > field_start && field_end > req_start) { | 228 | if (offset + size > field_start && field_end > offset) { |
| 233 | err = conf_space_read(dev, cfg_entry, field_start, | 229 | err = conf_space_read(dev, cfg_entry, field_start, |
| 234 | &tmp_val); | 230 | &tmp_val); |
| 235 | if (err) | 231 | if (err) |
| 236 | break; | 232 | break; |
| 237 | 233 | ||
| 238 | tmp_val = merge_value(tmp_val, value, get_mask(size), | 234 | tmp_val = merge_value(tmp_val, value, get_mask(size), |
| 239 | req_start - field_start); | 235 | offset - field_start); |
| 240 | 236 | ||
| 241 | err = conf_space_write(dev, cfg_entry, field_start, | 237 | err = conf_space_write(dev, cfg_entry, field_start, |
| 242 | tmp_val); | 238 | tmp_val); |
