Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1890145rwb; Fri, 11 Nov 2022 01:47:04 -0800 (PST) X-Google-Smtp-Source: AA0mqf4+651y8wdvjmCxG/CuPF4mllpFUVoaNP70vzNyixYp5qPgFOjqwFUbRc4om6/CpfE32w3p X-Received: by 2002:a17:906:2509:b0:772:e95f:cdce with SMTP id i9-20020a170906250900b00772e95fcdcemr1275834ejb.78.1668160024403; Fri, 11 Nov 2022 01:47:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668160024; cv=none; d=google.com; s=arc-20160816; b=frC5iOUk974xcBHIIRw2EInRG31hSdF9/UfmHwBv4WtA/wxpAG7Ca6eEZxYc0++aUZ /VpVsgRv/ZDrhPm0Xo3GUSzIqC6aWLNu/wQsOpjJTv3UWsSQt+COJP0a0nhr/dGEI0zh gNTNQF1OKey/2FHM7ZFGmJ3Z85Bq4lkA55vtI5JH0aQPqXxzZs8i6g4yYTEB65p+6t0M IqS98E8ExxtC3subT0Y908CObT2xdpBhWDW5ai2bw/nkxOWy9NUbmYKO2JEqLzAz7r6x Ct2HGXwvC4lBqj4ahdAY+uYmpn1LFEnAkwkIq/+tWnzOH4C2izSmJeBnxSDwBbscQGC4 dVeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Ffp0nnbtpIi4N+Qj8KSYxwNUefF7+vzVCBMkWQ6bMGY=; b=W6ELN73GEkbkcDrLeXfzw16F7hevf/JAClHF8Q2KE5NZHz/bjjSW5hPylPHbg6BPrh pZ5Zw+1WInL70WuMvunPP8+oPGijSCo3mKE2wOGTYfNK7dFc6CF9LWmYSIsFq4d9kijH LaCFkdtWA68vL1prgxe8ViGBHIV5zXGfW2IRInCeY22nlJBazGm0+E+7kBI9o0ZMVmgV cSnmEdxh4f5ZCMz9Q9q12+nAwX5Hr+FyGxVuStbJ+3Vt/jrly/n9lU5gFLRzkccQylPb bO/8XrqBgnSKN3tOp42xFinjR+MD7IE90Ro47EKTEwD5DGi+kKtYd3JYYzgTVooAA+9X 8/fQ== 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 g4-20020aa7c584000000b0045bd677b3d5si1569781edq.342.2022.11.11.01.46.33; Fri, 11 Nov 2022 01:47:04 -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 S232608AbiKKJmG (ORCPT + 99 others); Fri, 11 Nov 2022 04:42:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232987AbiKKJmG (ORCPT ); Fri, 11 Nov 2022 04:42:06 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 832FE69DC8 for ; Fri, 11 Nov 2022 01:42:05 -0800 (PST) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4N7ttP146jzbnfX for ; Fri, 11 Nov 2022 17:38:21 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 11 Nov 2022 17:42:03 +0800 Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 11 Nov 2022 17:42:03 +0800 From: Xiongfeng Wang To: , , CC: , , Subject: [PATCH] crypto: hisilicon/qm - add missing pci_dev_put() in q_num_set() Date: Fri, 11 Nov 2022 18:00:36 +0800 Message-ID: <20221111100036.129685-1-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 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); -- 2.20.1