From patchwork Fri Jul 6 10:28:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 141287 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2945125ljj; Fri, 6 Jul 2018 03:29:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfaaLYshPXXhCSv6pfmcJGA6zf2YVA72wS/XZiKWHONKq6m20Xn7nppQrn610MwB9OjsbOf X-Received: by 2002:a17:902:650a:: with SMTP id b10-v6mr9878724plk.45.1530872974201; Fri, 06 Jul 2018 03:29:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530872974; cv=none; d=google.com; s=arc-20160816; b=lp5qTD00mEXp7Sox/D6ftArnOApo8myK6tloojEwgdO4p2wfJuSrlTijdRsMYjJFLr sNSY3f/SFVJ96hd7Uu+iMKWdIcu6gWo4hmi4xeRgQxop99pnZLNB3iAPlvQxxlGgOIrt +2l63uD/XfXzXe3BavmZUGTMtk36l1zJ9oXMJxsjx/J5p9hicCZHVxNVVnSEAqv8tzoM UlF6xtROJdA0ZnQKFRGbPE9k1plaIxSoh2Wy6UPVh6NlAMNw4luPi4+cQBaB43l3Gg6H OsvwI0hjLZJWQJhHHKGd9ikaa27WsPGZbnPL7Pv1QkhMb1a9yPyUU2w4nXEr5Mp/kWXl zKIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=9A3JCMy7TDUadk496AlIPwoyAn7KfEKOK8QVz4rAtkc=; b=omo8eTgHwReEqm0GbEAkuFr3FiJZhEdMb1GqA3VDSqUVEtmSeNEOw8F8IN6Ya+dcoL sggmCIxtfjydmWFqCpKizSYJ5HcHowiti39XE8fU2cX1LUXSLET3HFKvhPcuWBfs7TEh GwuWjOWkp4k6IgFvYqv7tuljeYb1qSPn0edXzYqJ/nlkeolgMwrknfZzolsQEYuYqueU /TKbMQQYxRZhMKrESquoj9z3nAulxDWzbhsG1tnTsbsJc1sSL8iv9iB74DECw3YQCe6O UkTkXOUSH4pMQ+bZ1xJsvGMRTOeWb4vGFl48jo3bLjFacfFPnUkhfmo8m+urSiY6rBY/ ZXBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p3-v6si7941636plr.131.2018.07.06.03.29.33; Fri, 06 Jul 2018 03:29:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932832AbeGFK3c (ORCPT + 10 others); Fri, 6 Jul 2018 06:29:32 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:9207 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932771AbeGFK3a (ORCPT ); Fri, 6 Jul 2018 06:29:30 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 5CA4F771F5B1A; Fri, 6 Jul 2018 18:29:15 +0800 (CST) Received: from S00293818-DELL1.huawei.com (10.202.226.54) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.382.0; Fri, 6 Jul 2018 18:29:09 +0800 From: Salil Mehta To: CC: , , , , , , , Yunsheng Lin Subject: [PATCH net-next 08/10] net: hns3: Fix get_vector ops in hclgevf_main module Date: Fri, 6 Jul 2018 11:28:02 +0100 Message-ID: <20180706102804.196-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180706102804.196-1-salil.mehta@huawei.com> References: <20180706102804.196-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Yunsheng Lin The hclgevf_free_vector function expects the caller to pass the vector_id to it, and hclgevf_put_vector pass vector to it now, which will cause vector allocation problem. This patch fixes it by converting vector into vector_id before calling hclgevf_free_vector. Fixes: e2cb1dec9779 ("net: hns3: Add HNS3 VF HCL(Hardware Compatibility Layer) Support") Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c index 5a86532..d1f16f0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c @@ -658,8 +658,17 @@ static int hclgevf_unmap_ring_from_vector( static int hclgevf_put_vector(struct hnae3_handle *handle, int vector) { struct hclgevf_dev *hdev = hclgevf_ae_get_hdev(handle); + int vector_id; + + vector_id = hclgevf_get_vector_index(hdev, vector); + if (vector_id < 0) { + dev_err(&handle->pdev->dev, + "hclgevf_put_vector get vector index fail. ret =%d\n", + vector_id); + return vector_id; + } - hclgevf_free_vector(hdev, vector); + hclgevf_free_vector(hdev, vector_id); return 0; }