From patchwork Thu Aug 29 03:35:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Ruibin <11162571@vivo.com> X-Patchwork-Id: 13782415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3B77FC5474D for ; Thu, 29 Aug 2024 03:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=l+SJyvgGmlr4LJzqSB80oelghqemjzOEvj8gkZqPhpY=; b=I4T3eGv8Af3WD0UI+jfh6nvxtE d/7uQZEn/ikl7QgQ085aFFPRJ3oM6v3FjE4uunJO8ml0EWVr0476Z+xwMmBqHVSfqd8A2gct7pr8/ wO0nBkfUbFmkDgQtne0lIheGngQ1rkPQfCCuyZSiA/0RXkkDfW2VEpuxud/+m/oRIML8OqUKN6xYm MZoaB6WztMnOjGUE1vv1nKvrJNF96ymvHB+A5f/0D20bJiWFlJktSS9l3o5Eg+NkrD7FaVrgLVFgZ W8QmVbzv4Ub14i+EWZv0NPOzJRSVB0t0XkpgCiOYMGzgYEEaqtJ5I7wrIL3ezaSRFMJjyOvVBi2n9 XzuKojvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjVxk-00000000NfJ-1ZeO; Thu, 29 Aug 2024 03:36:44 +0000 Received: from mail-sgaapc01on20607.outbound.protection.outlook.com ([2a01:111:f400:feab::607] helo=APC01-SG2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjVwt-00000000Na0-0utJ for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 03:35:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=eePDTnN8FcmdMiT0/K8pQMeq8FpHiWICIz6KOdk8qAPHF3n131O7WW7P0OeYOU86GMfARV5DSQLUR5OQsFHz5Nj2AG//yZwkdyd4SiAgmlvHYtqLumZlIiespR7wyEz/EKwdjv8BiznZXDUuVAGIeHy9d9iPQPqWERZz2SLGAJmsw3q98iW03ZFu3L7jgaYFiMhSKxhx0ToGF+CoInD/drMOMzgY4jNASNXHPHjGPYoHJPiDQCQ1d5y62ii4fgISi6T4rrJ8dC3UjM+B4wFrpIjHHCnEa8KFw48TKNA70w+7cVz8A9RzQfhBS+3B/HZG2O/ddLd/Rkp6QJNlZ3AiVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l+SJyvgGmlr4LJzqSB80oelghqemjzOEvj8gkZqPhpY=; b=x6t9y/cmNoJjF5qBs18FVByJu/pvMe7bHN1FOkc5gQ4cKNqYUpnEiZ9qw82pVr8/KPuDePpZc+yl5GCwiUj/Q94sLfruA7ZKfyhkU3+jLSO6X++VzWh2kozPEZTwZMH3RL6LFpJ1H6/YvfCEpkucc1y7LzbikVrJdCAaV+0YM7OeLlhAqNP3wUeIHMZLTuBEESowUIqkgsADMoCQ90SpC4BwWixkuhDNyL2p4Af0PjasPiC89VdOgnjBqg4Gs681azW/RwVTYZtgNt4qtjOC69UTYp8/k6XoNpdK4Rs4yuBjO9QR+WJyv7nj+5pVzWgEgBhKk/6JrKhkbUAXeHNt7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l+SJyvgGmlr4LJzqSB80oelghqemjzOEvj8gkZqPhpY=; b=OGOKVC7t9MURvnnml5r2EIXHJ0xaG+/MGgyHl2tsV9YA1fvdRiajlFmjTBE1IXi/OCuC9m4jIA5xJrzPPLP+vKFqeg6d58n2fq1NTWauCwd3ul+sFsPwo/BxbQwhyGEQbUAd4v71jqRJQNiIMJy9/WF4dAM6Wjlzi4G0DF3R2a6j0eM1g1h+qqOZN4LzKMKehJxewFY/4FTUeDTpGVpS/xKtX/6R3BoP4CtqWWEdKS0d6PofZM/X6a7jqh9Ti50RTs0G8R3PpNGePxiSXB46Qwz7KbOIVUb7d1wapVEFxlual89haXhczT/2OaztWkEv17fBDnJhl16RGC2uYbHawQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from TYZPR06MB6263.apcprd06.prod.outlook.com (2603:1096:400:33d::14) by TYUPR06MB6152.apcprd06.prod.outlook.com (2603:1096:400:35f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.24; Thu, 29 Aug 2024 03:35:25 +0000 Received: from TYZPR06MB6263.apcprd06.prod.outlook.com ([fe80::bd8:d8ed:8dd5:3268]) by TYZPR06MB6263.apcprd06.prod.outlook.com ([fe80::bd8:d8ed:8dd5:3268%6]) with mapi id 15.20.7897.027; Thu, 29 Aug 2024 03:35:24 +0000 From: Yang Ruibin <11162571@vivo.com> To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Yang Ruibin <11162571@vivo.com> Subject: [PATCH v2] drivers: spi: Insert the missing pci_dev_put()before return Date: Thu, 29 Aug 2024 11:35:11 +0800 Message-Id: <20240829033511.1917015-1-11162571@vivo.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: TY2PR0101CA0036.apcprd01.prod.exchangelabs.com (2603:1096:404:8000::22) To TYZPR06MB6263.apcprd06.prod.outlook.com (2603:1096:400:33d::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR06MB6263:EE_|TYUPR06MB6152:EE_ X-MS-Office365-Filtering-Correlation-Id: a8ba5c6b-c538-49e2-9711-08dcc7db9e0c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|52116014|376014|38350700014|81742002|41080700001; X-Microsoft-Antispam-Message-Info: 5VxRMnYu9HNgenPfOGEn59+iicvLNRyii9WOXB46bT0w9fy7xEydCY4LGOEoF4nU0y70Tq5wnhzgXdiyyd1fXvLDoedJ1WORXCSrK7vPDr2y2eaHswtccvsFSJchO+q2/SP4SRlV5srjA90j4PO4u7cyylwZrmoFSdQW8LFfw5xu58n6BPgCkklt7163sRPUq9pl+akHp+ZaGElHLQxslQw6y2q5vtIiopwzPZjLD2rwcBNbj6dV+NmvVj6xZ3bq7m9PL8JkQiHiGrYOraGpyh4x89n0VNetLeeRcOdkgtlZ6cQ7Bc4a67xhXAx7L6mlGwdEzQC4Pp72/QLsI2VzrhUjBV93oK2BOkGyTgWGthWjUaVS1z2MB6DmH1VWs3pV4sTwtivPLusJa6sirN8Lh1jAIXM44GJLz+YRmaDoXEpmI5yv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am-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYZPR06MB6263.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(52116014)(376014)(38350700014)(81742002)(41080700001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5Cme6RhdPjm5bI01MCJjXYCL1NUDG3yGkD2eZngSn0SCzLNCg0ClOR2f6jC7Wxy4RmUz4Qu8IepbbAGTx2BiQvY8Kh7aTKY1H0AUoXQStRAbSffrqGOZi/wAPT8zzu7XDcbgaUQN7Z3UUhdaYNFqHFmToQCpdNDg2W+guUPxYT1Ig793QOus4hHIfnGrm96taan/B7NdLisfjcSnvDULH2W5hZ/tOreFN+LBZSG9g/J8lggh0anV7UhA4KGJ3mji9Ao6EACScqfoLbrnUkm0/MYqJpmZM/W+RTk18Soqgxjc4+66kaf/ph4hRyAfrnXa2sRMq2dPCLYJDA8eeoO8i7BvAEdnNMuVrYv+6Bu/9xz+LRvfkeHZ719vr1vbJZeASs8U3B0lmk4UxlqVc/N085109UujyE2tBsTE+N3HWR/MDUKxtjRryufZw5FviufuhCyG0m/wdvx4L7s7UtjXhPof/3ubsYbehu2N8thJVh4ly/sAo6QqwENUHVLaDJWEkgx6hKg7QyyEqvKVnmauEZc10muvXvsZJsGcMl1r8Ky4SaWCaclOX8vFPpHjsdIAwiBbLlO+uvYGT/g8i6HwOPDNmUhGEMSqYRfaFg0EHQiuyOiQT6WFamt1JrN4LL5hJDox5mSNB370XeNiiKzJdRJTbATThNupAD6SncMjretoKN5Yiius5PXaC8ZPMkzFRfqg+umetEwmPf+cz+m910P3dSE8xLpndnbsx6RSvEkWmEN3gRwpes1vJAn/Aq8AhoJehuVNGt8ARqWkPyRhjSU4r8NP67oXega5Rc2WPB2IqLKM68Jn8MDzp21EAsLkwcLxHyxbkF2n2QgE7E2P444Xt5KIJOtf514ih1Pg9ExLZDvv9QLYA+s7Q2t1oc599VtGLcuqxrO3fwec7Dl75Iu3hDQq+4KvklrGwtnxGLtx4SJ0I+i6UI5HxCcicGRR00Jgba4IsLlA+8GZFIZDpunkpEVsLNWnM9pmLjCaMFVSHJiuBZ9NL2bHXPx/nb4FvWUySTew2CuU6Dv1GR2GsQmtcXJqZMOtfNgLke0CXrO8Vl4R0YXo8CZ6CGWodumjc3pGG9Klc1sJa3eYH2Uy74FHv/QsBcgKseTBG3flpPDCB8ndJGtKrBbzBC5QAiK2vIjJnbpzZ6JTx4vP7nPXFuJXvVnVLEP02Nb/ziJ9oC+qMf0/0Hnm/42BYeiMbipPy1x7Is55cgTSC5LPkEBnyNzalIy7GXzTxSl7VFeVmt2CB7PdJxhPWXj8dvEpUKDRcCHjcZNCuQf58scaNj/kZOIZJWJXQTE71psOLvtPBGC8kmx4coIPRdRaZ4khtd+jjFZmuwMgUU6D3ac8pVR6mQrYl2vW/WRDf/RBtzj2zET1xNriGgJS8ZWEvBtl95lZHxhD1Rokba9MPpkxdZrR/HxazYO0VLtd77XGS/aHKkL6/iwHqY+qX5ZDp+U93j+q/J1b7L8MOs7DwVeLPYYYtBfl65jD8exzUSV3AMEWtwlPoFVsrHcJQ7zo+835E9IzuvIgKvQ43sY8RQzb3YZ00JzXAYe0IiT8HU5QIBmVzJdmklTAuxd4x6HNt+NY/4Nk X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: a8ba5c6b-c538-49e2-9711-08dcc7db9e0c X-MS-Exchange-CrossTenant-AuthSource: TYZPR06MB6263.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Aug 2024 03:35:24.5234 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UR8/gMNN8LSVTLTZW7jo+UzaJu4y8Zw+hoAq9n1nMEjgHttoimOB+kkSFpbwc4GuG+JgmDPHqHsZ2Yvihn7L9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYUPR06MB6152 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_203551_270808_4849AA8D X-CRM114-Status: GOOD ( 10.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Increase the reference count by calling pci_get_slot(), and remember to decrement the reference count by calling pci_dev_put(). Signed-off-by: Yang Ruibin <11162571@vivo.com> --- drivers/spi/spi-pxa2xx-pci.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index cc8dcf782..a7bf4568f 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -146,8 +146,10 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c) c->num_chipselect = 1; ret = pxa2xx_spi_pci_clk_register(dev, ssp, 50000000); - if (ret) + if (ret) { + pci_dev_put(dma_dev); return ret; + } dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); @@ -222,8 +224,10 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c) } ret = pxa2xx_spi_pci_clk_register(dev, ssp, 25000000); - if (ret) + if (ret) { + pci_dev_put(dma_dev); return ret; + } dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev);