Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5391076rwb; Mon, 14 Nov 2022 04:07:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+EqHWs0BxQjv+B6hJT+RPpLkLPSrawg5UE2cZb97ZXgFcWhALvynVgMH+962cUunNVPwl X-Received: by 2002:a17:902:8d94:b0:188:572c:b9c3 with SMTP id v20-20020a1709028d9400b00188572cb9c3mr13724255plo.53.1668427652601; Mon, 14 Nov 2022 04:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668427652; cv=none; d=google.com; s=arc-20160816; b=YJXqI/0JkkSUoBM5trEoY4KqHMpQb1sjj7P13MdJVjDWNVq77DZkN81D3t8BzUW4d5 xLSCkylcX4m/YQ/gn6eHiK2Noh3QBdMjrd0NNmkfsVRLGWYE14JzkVJUUokErsN726Jy +mMtsT6JHEKowvHZ+3DN2+8UepF1FJ5wZVJPNjTqSzc5ZG/arq+LfzzXgDgSiWMumnXR egXbhD7Iys6+41t9GZtAgDfJMDM+itGs047tUQa07FJeahrg+ziATkX0KdIgu6Bn3kVE wmyUflk5vOdIgaMRqZsF4zKkiy9rJowk8F4q6iGO1JbWDiCnKJ940ORVsSmHIi8cZmh7 /Jvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=BTp3LUCfgneqrz3vtxswJNbHScmF2nU7qlnguY6TvQM=; b=iDGcSyWJfBgCEQJRP3+JSLfiv+MeI0AeEGOekqpg3t+j/SmmFlZekee9sbBD4VOsDP FkjrnlJ5oWlgv7oyCRywsxhDwX19mrghEphQuvJgscWq1vEyLR214YuFcY5WQPjpWfKQ WGRJgz/F/hIjbOk8QAsKpHnWjIC98ZFizKNk0PxAVzYHYn14/DwrO82I9/xuZR65chB/ uAonFajVz1v2mejN0Q9Jh3RFKAdJMO30uyB2GEzxYrmBvq9bKCMtvo7yY/3zy+w+d6UZ k3sqpH+W+8d76kzL83MgoOuPNNI3X10yMlZav3CNzAy7sOkFNVKSt4dXuaKxohooBdM2 1gwQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h185-20020a6383c2000000b0045c59e9a8a9si9693812pge.322.2022.11.14.04.07.11; Mon, 14 Nov 2022 04:07:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236902AbiKNLyD (ORCPT + 99 others); Mon, 14 Nov 2022 06:54:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235900AbiKNLxu (ORCPT ); Mon, 14 Nov 2022 06:53:50 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92C082BB3C for ; Mon, 14 Nov 2022 03:49:27 -0800 (PST) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N9nYv6xHNzqSSW for ; Mon, 14 Nov 2022 19:45:39 +0800 (CST) Received: from kwepemm600009.china.huawei.com (7.193.23.164) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 14 Nov 2022 19:49:25 +0800 Received: from [10.67.101.184] (10.67.101.184) by kwepemm600009.china.huawei.com (7.193.23.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 14 Nov 2022 19:49:25 +0800 Subject: Re: [PATCH] crypto: hisilicon/qm - add missing pci_dev_put() in q_num_set() To: Xiongfeng Wang , , References: <20221111100036.129685-1-wangxiongfeng2@huawei.com> CC: , From: Weili Qian Message-ID: <0b1c041c-4368-82d4-bbce-b964e7dd4d77@huawei.com> Date: Mon, 14 Nov 2022 19:49:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20221111100036.129685-1-wangxiongfeng2@huawei.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.101.184] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600009.china.huawei.com (7.193.23.164) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 2022/11/11 18:00, Xiongfeng Wang wrote: > pci_get_device() will increase the reference count for the returned > pci_dev. We need to use pci_dev_put() to decrease the reference count > before q_num_set() returns. > > Signed-off-by: Xiongfeng Wang > --- > include/linux/hisi_acc_qm.h | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h > index e230c7c46110..c3618255b150 100644 > --- a/include/linux/hisi_acc_qm.h > +++ b/include/linux/hisi_acc_qm.h > @@ -384,14 +384,14 @@ struct hisi_qp { > static inline int q_num_set(const char *val, const struct kernel_param *kp, > unsigned int device) > { > - struct pci_dev *pdev = pci_get_device(PCI_VENDOR_ID_HUAWEI, > - device, NULL); > + struct pci_dev *pdev; > u32 n, q_num; > int ret; > > if (!val) > return -EINVAL; > > + pdev = pci_get_device(PCI_VENDOR_ID_HUAWEI, device, NULL); > if (!pdev) { > q_num = min_t(u32, QM_QNUM_V1, QM_QNUM_V2); > pr_info("No device found currently, suppose queue number is %u\n", > @@ -401,6 +401,8 @@ static inline int q_num_set(const char *val, const struct kernel_param *kp, > q_num = QM_QNUM_V1; > else > q_num = QM_QNUM_V2; > + > + pci_dev_put(pdev); > } > > ret = kstrtou32(val, 10, &n); > Looks good! Reviewed-by: Weili Qian Thanks!