From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD5C7C43334 for ; Tue, 7 Jun 2022 19:46:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357104AbiFGTq3 (ORCPT ); Tue, 7 Jun 2022 15:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354621AbiFGSrb (ORCPT ); Tue, 7 Jun 2022 14:47:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F25C237A92; Tue, 7 Jun 2022 11:02:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 70294B82343; Tue, 7 Jun 2022 18:02:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8244CC34115; Tue, 7 Jun 2022 18:02:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654624955; bh=c+ctPUQM9DoagDrIqdEoBv221V9tAwf8N+RV88BNbt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d95VIjwXL6pEs2r3Oz0kttrf9uQpRPzPLCaw1UihxaXSEnNRWl7zaLwzKLvN4U9ZL hFSj6TYRnoCQkNx2uBdltIc8HIaLh4Ps0pqbofEc2eIiasIoO2QKa1SHLpJAELFCGk pqGydTT75uRo/AXsSboC6ldN/UfYGmzS9zC1wD6+6H/lrqqpROfl/UNFWGeHD+rFgK ZFn7Rwr3roUafU41r3vyWgic7Kib8bP2ZrTZAmiUnBbsZcZiimpHxwmTH5R/MBxxJz b1b9K280RZHlswbXy0iB0Le7G4Y/IIZTUkOZj3Fr5rzmDD1vOPBxp0ihCCXrqRLIye FG4cftyi7ZfeA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Huang Guobin , Jiri Slaby , Greg Kroah-Hartman , Sasha Levin , linux-serial@vger.kernel.org Subject: [PATCH AUTOSEL 4.14 04/25] tty: Fix a possible resource leak in icom_probe Date: Tue, 7 Jun 2022 14:02:05 -0400 Message-Id: <20220607180229.482040-4-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220607180229.482040-1-sashal@kernel.org> References: <20220607180229.482040-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huang Guobin [ Upstream commit ee157a79e7c82b01ae4c25de0ac75899801f322c ] When pci_read_config_dword failed, call pci_release_regions() and pci_disable_device() to recycle the resource previously allocated. Reviewed-by: Jiri Slaby Signed-off-by: Huang Guobin Link: https://lore.kernel.org/r/20220331091005.3290753-1-huangguobin4@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/icom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c index fe92d74f4ea5..4711b3ec2c56 100644 --- a/drivers/tty/serial/icom.c +++ b/drivers/tty/serial/icom.c @@ -1515,7 +1515,7 @@ static int icom_probe(struct pci_dev *dev, retval = pci_read_config_dword(dev, PCI_COMMAND, &command_reg); if (retval) { dev_err(&dev->dev, "PCI Config read FAILED\n"); - return retval; + goto probe_exit0; } pci_write_config_dword(dev, PCI_COMMAND, -- 2.35.1