lkml.org 
[lkml]   [2020]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v2] staging: gasket: core: Fix a coding style issue in gasket_core.c
On Thu, Jun 18, 2020 at 12:11:27AM +0800, Zhixu Zhao wrote:
> diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
> index 67325fbaf760..28dab302183b 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -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 =
> internal_desc->driver_desc;
> ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Get rid of this as well (below).

> + struct gasket_bar_data *data;
> int ret;
>
> if (desc_bytes == 0)
> @@ -270,31 +271,32 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
> /* not PCI: skip this entry */
> return 0;
> }
> +
> + data = &gasket_dev->bar_data[bar_num];

It would be better to do this in the declaration block so you can change
the earlier two uses in this function:

+ struct gasket_bar_data *data = &gasket_dev->bar_data[bar_num];
- ulong desc_bytes = driver_desc->bar_descriptions[bar_num].size;
+ ulong desc_bytes = data->size;

...

- if (driver_desc->bar_descriptions[bar_num].type != PCI_BAR) {
+ if (data->type != PCI_BAR) {

regards,
dan carpenter

\
 
 \ /
  Last update: 2020-06-17 21:10    [W:0.097 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site