Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4013060yba; Wed, 17 Apr 2019 02:42:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9Rik6xYsYSEAIQmxjE+Drh35WJyk6Xa+I1z3lrH8iGTh3ccFvi490ZvfXOniRwqV9BqQ2 X-Received: by 2002:a62:e710:: with SMTP id s16mr80051183pfh.74.1555494172694; Wed, 17 Apr 2019 02:42:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555494172; cv=none; d=google.com; s=arc-20160816; b=Wk6HCXabrRyPnPeLt/cN54HaPkGapkAGtnwucYMnUODOz9Yg3LXzKug1aPtt6okDCQ YPfULz9CPaCiDYimiD7nTmtkZbUz1m7A/IpACn3E6L+aYJdorAJD7duTnhne/ta66l69 61vrEftjF0d272lF48O/Y+CC9Syq/fCOi2q6jKxEw2SrIRkIUtLjaBar1jIjfN1fZ4Kp F9m2A1AC4YJETTlmBZ9uZbWDZP57OhCSmTghv4/SdYneKXDRpzCguvnYjs4FUTK15u7D 0R+AdRROmbTGowIWxwxDDkU8YyR08r0BvaIQ94zzUnAmEtryOunPAGV+6Arl8OukbAAd ZjZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=FB96HGIvgdVb9qSx9R4mbXL9ivfhVDleOfilXfKKmtA=; b=xTzOejV2LDwLdR9RYYZTOW5CL89aIwDMi4Ymf4NmLOPsMZ8IqrDJQOaYErm/O0Odq2 kBrp/6xy4/lEA8kiW+oSSyuyWL0Hr6MxrVF6W7Mswc9h6f8zXfAGXpZtUlQAqGdAtQr1 qg8ThXYxbyu5eDjNNzQqv6ambOTPe6jRXlB8wvvNw/bmfKeG6ZPGAWZexYZusFM/aNxu KZfBh++GsDo+i7eBNkFYM+6eYnd2EJHXkWtQ1mbNrgbb9TJWVBrnz4fjc43FjMtmoyac P3SjM+f6SPfJxSSifAjJCdHFiN0dhOzwf/B2PRDJhenNC3H/rmYaJZl5dvJfw+aUJaw6 ZWVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=CVZuMCWP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l191si38357432pfc.213.2019.04.17.02.42.38; Wed, 17 Apr 2019 02:42:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b=CVZuMCWP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731633AbfDQJlk (ORCPT + 99 others); Wed, 17 Apr 2019 05:41:40 -0400 Received: from m50-132.163.com ([123.125.50.132]:35756 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726237AbfDQJlk (ORCPT ); Wed, 17 Apr 2019 05:41:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=FB96HGIvgdVb9qSx9R 4mbXL9ivfhVDleOfilXfKKmtA=; b=CVZuMCWP6H5TVJJHDhC0LnwI1rCmg/ifhh NwudJ194vC6Bl51m/XS5KAYMZroxPPPSFNONEBbL0QEVQUr3a2ypKgKnLjG6VE5z ISk2MO4aPT/C5UzYt1gfu45ns/7gsNwgWO6sZsHZMHMjntwRTspAym/8iP0/XvPC FV8C766nA= Received: from bp.localdomain (unknown [218.106.182.174]) by smtp2 (Coremail) with SMTP id DNGowABHAnHH9LZcRelUAA--.6S3; Wed, 17 Apr 2019 17:41:29 +0800 (CST) From: Pan Bian To: Christian Lamparter , Kalle Valo , "David S. Miller" Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: p54: drop device reference count if fails to enable device Date: Wed, 17 Apr 2019 17:41:23 +0800 Message-Id: <1555494083-130833-1-git-send-email-bianpan2016@163.com> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: DNGowABHAnHH9LZcRelUAA--.6S3 X-Coremail-Antispam: 1Uf129KBjvdXoWrtF4kCF1xtw1DGryfWFyfZwb_yoWDuFc_GF WxZFZ7XryrAr109r1fCr43AFya9FnIqFs5Wrs7t3yFgrWUXFWDGrZ8ZF9rJr95W3y0vryD tr1DJr4fWayjgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjmhFDUUUUU== X-Originating-IP: [218.106.182.174] X-CM-SenderInfo: held01tdqsiiqw6rljoofrz/xtbBZACZclQHEeYRlAAAsu Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The function p54p_probe takes an extra reference count of the PCI device. However, the extra reference count is not dropped when it fails to enable the PCI device. This patch fixes the bug. Signed-off-by: Pan Bian --- drivers/net/wireless/intersil/p54/p54pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/p54/p54pci.c b/drivers/net/wireless/intersil/p54/p54pci.c index 27a4906..57ad564 100644 --- a/drivers/net/wireless/intersil/p54/p54pci.c +++ b/drivers/net/wireless/intersil/p54/p54pci.c @@ -554,7 +554,7 @@ static int p54p_probe(struct pci_dev *pdev, err = pci_enable_device(pdev); if (err) { dev_err(&pdev->dev, "Cannot enable new PCI device\n"); - return err; + goto err_put; } mem_addr = pci_resource_start(pdev, 0); @@ -639,6 +639,7 @@ static int p54p_probe(struct pci_dev *pdev, pci_release_regions(pdev); err_disable_dev: pci_disable_device(pdev); +err_put: pci_dev_put(pdev); return err; } -- 2.7.4