[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150726064908.GA2153@nanopsycho.fritz.box>
Date: Sun, 26 Jul 2015 08:49:08 +0200
From: Jiri Pirko <jiri@...lanox.com>
To: Scott Feldman <sfeldma@...il.com>
CC: Jiri Pirko <jiri@...nulli.us>, Netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>, <idosch@...lanox.com>,
<eladr@...lanox.com>,
"ogerlitz@...lanox.com" <ogerlitz@...lanox.com>,
Roopa Prabhu <roopa@...ulusnetworks.com>,
Florian Fainelli <f.fainelli@...il.com>,
"Thomas Graf" <tgraf@...g.ch>,
Alexei Starovoitov <ast@...mgrid.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Daniel Borkmann <daniel@...earbox.net>,
john fastabend <john.fastabend@...il.com>,
"simon.horman@...ronome.com" <simon.horman@...ronome.com>,
John Linville <linville@...driver.com>,
"Andy Gospodarek" <andy@...yhouse.net>,
Shrijeet Mukherjee <shm@...ulusnetworks.com>,
"nhorman@...driver.com" <nhorman@...driver.com>
Subject: Re: [patch net-next 2/4] mlxsw: Add PCI bus implementation
Sun, Jul 26, 2015 at 07:15:04AM CEST, sfeldma@...il.com wrote:
>On Thu, Jul 23, 2015 at 8:43 AM, Jiri Pirko <jiri@...nulli.us> wrote:
>> From: Jiri Pirko <jiri@...lanox.com>
>>
>> Add PCI bus implementation for Mellanox Technologies Switch ASICs. This
>> includes firmware initialization, async queues manipulation and command
>> interface implementation.
>>
>> Signed-off-by: Jiri Pirko <jiri@...lanox.com>
>> Signed-off-by: Ido Schimmel <idosch@...lanox.com>
>> Signed-off-by: Elad Raz <eladr@...lanox.com>
>> ---
>
>[cut]
>
>> +static int mlxsw_pci_fw_area_init(struct mlxsw_pci *mlxsw_pci, char *mbox,
>> + u16 num_pages)
>> +{
>> + struct mlxsw_pci_mem_item *mem_item;
>> + int i;
>> + int err;
>
>Need to init err to zero here
You are right. We need to set err before "goto err_alloc". Thanks.
>
>> +
>> + mlxsw_pci->fw_area.items = kcalloc(num_pages, sizeof(*mem_item),
>> + GFP_KERNEL);
>> + if (!mlxsw_pci->fw_area.items)
>> + return -ENOMEM;
>> + mlxsw_pci->fw_area.num_pages = num_pages;
>> +
>> + mlxsw_cmd_mbox_zero(mbox);
>> + for (i = 0; i < num_pages; i++) {
>> + mem_item = &mlxsw_pci->fw_area.items[i];
>> +
>> + mem_item->size = MLXSW_PCI_PAGE_SIZE;
>> + mem_item->buf = pci_alloc_consistent(mlxsw_pci->pdev,
>> + mem_item->size,
>> + &mem_item->mapaddr);
>> + if (!mem_item->buf)
>> + goto err_alloc;
>> + mlxsw_cmd_mbox_map_fa_pa_set(mbox, i, mem_item->mapaddr);
>> + mlxsw_cmd_mbox_map_fa_log2size_set(mbox, i, 0); /* 1 page */
>> + }
>> +
>> + err = mlxsw_cmd_map_fa(mlxsw_pci->core, mbox, num_pages);
>> + if (err)
>> + goto err_cmd_map_fa;
>> +
>> + return 0;
>> +
>> +err_cmd_map_fa:
>> +err_alloc:
>> + for (i--; i >= 0; i--) {
>> + mem_item = &mlxsw_pci->fw_area.items[i];
>> +
>> + pci_free_consistent(mlxsw_pci->pdev, mem_item->size,
>> + mem_item->buf, mem_item->mapaddr);
>> + }
>> + kfree(mlxsw_pci->fw_area.items);
>> + return err;
>> +}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists