Commit a7a49357 authored by Zhixu Zhao's avatar Zhixu Zhao Committed by Greg Kroah-Hartman

staging: gasket: core: Fix a coding style issue in gasket_core.c

A coding alignment issue is found by checkpatch.pl.
Fix it by using a temporary for gasket_dev->bar_data[bar_num].
Signed-off-by: default avatarZhixu Zhao <zhixu001@126.com>
Link: https://lore.kernel.org/r/20200715133313.16327-1-zhixu001@126.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d1e8c52a
...@@ -261,6 +261,7 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num) ...@@ -261,6 +261,7 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
const struct gasket_driver_desc *driver_desc = const struct gasket_driver_desc *driver_desc =
internal_desc->driver_desc; internal_desc->driver_desc;
ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size; ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
struct gasket_bar_data *data;
int ret; int ret;
if (desc_bytes == 0) if (desc_bytes == 0)
...@@ -270,31 +271,32 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num) ...@@ -270,31 +271,32 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
/* not PCI: skip this entry */ /* not PCI: skip this entry */
return 0; return 0;
} }
data = &gasket_dev->bar_data[bar_num];
/* /*
* pci_resource_start and pci_resource_len return a "resource_size_t", * pci_resource_start and pci_resource_len return a "resource_size_t",
* which is safely castable to ulong (which itself is the arg to * which is safely castable to ulong (which itself is the arg to
* request_mem_region). * request_mem_region).
*/ */
gasket_dev->bar_data[bar_num].phys_base = data->phys_base =
(ulong)pci_resource_start(gasket_dev->pci_dev, bar_num); (ulong)pci_resource_start(gasket_dev->pci_dev, bar_num);
if (!gasket_dev->bar_data[bar_num].phys_base) { if (!data->phys_base) {
dev_err(gasket_dev->dev, "Cannot get BAR%u base address\n", dev_err(gasket_dev->dev, "Cannot get BAR%u base address\n",
bar_num); bar_num);
return -EINVAL; return -EINVAL;
} }
gasket_dev->bar_data[bar_num].length_bytes = data->length_bytes =
(ulong)pci_resource_len(gasket_dev->pci_dev, bar_num); (ulong)pci_resource_len(gasket_dev->pci_dev, bar_num);
if (gasket_dev->bar_data[bar_num].length_bytes < desc_bytes) { if (data->length_bytes < desc_bytes) {
dev_err(gasket_dev->dev, dev_err(gasket_dev->dev,
"PCI BAR %u space is too small: %lu; expected >= %lu\n", "PCI BAR %u space is too small: %lu; expected >= %lu\n",
bar_num, gasket_dev->bar_data[bar_num].length_bytes, bar_num, data->length_bytes, desc_bytes);
desc_bytes);
return -ENOMEM; return -ENOMEM;
} }
if (!request_mem_region(gasket_dev->bar_data[bar_num].phys_base, if (!request_mem_region(data->phys_base, data->length_bytes,
gasket_dev->bar_data[bar_num].length_bytes,
gasket_dev->dev_info.name)) { gasket_dev->dev_info.name)) {
dev_err(gasket_dev->dev, dev_err(gasket_dev->dev,
"Cannot get BAR %d memory region %p\n", "Cannot get BAR %d memory region %p\n",
...@@ -302,10 +304,8 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num) ...@@ -302,10 +304,8 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
return -EINVAL; return -EINVAL;
} }
gasket_dev->bar_data[bar_num].virt_base = data->virt_base = ioremap(data->phys_base, data->length_bytes);
ioremap(gasket_dev->bar_data[bar_num].phys_base, if (!data->virt_base) {
gasket_dev->bar_data[bar_num].length_bytes);
if (!gasket_dev->bar_data[bar_num].virt_base) {
dev_err(gasket_dev->dev, dev_err(gasket_dev->dev,
"Cannot remap BAR %d memory region %p\n", "Cannot remap BAR %d memory region %p\n",
bar_num, &gasket_dev->pci_dev->resource[bar_num]); bar_num, &gasket_dev->pci_dev->resource[bar_num]);
...@@ -319,9 +319,8 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num) ...@@ -319,9 +319,8 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
return 0; return 0;
fail: fail:
iounmap(gasket_dev->bar_data[bar_num].virt_base); iounmap(data->virt_base);
release_mem_region(gasket_dev->bar_data[bar_num].phys_base, release_mem_region(data->phys_base, data->length_bytes);
gasket_dev->bar_data[bar_num].length_bytes);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment