Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp1850699imn; Mon, 1 Aug 2022 02:29:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR4PMRYhTISgpM5IF0RmVzBr0XhFy9xx2WJGzaA83EnluQrdcbG/W/aIhnFedvVvAJHRad75 X-Received: by 2002:a17:90a:df14:b0:1f3:3a50:9dc1 with SMTP id gp20-20020a17090adf1400b001f33a509dc1mr16211383pjb.139.1659346153084; Mon, 01 Aug 2022 02:29:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659346153; cv=none; d=google.com; s=arc-20160816; b=yGsissE0tITmMwhASNsaCDNg7zQkbDz75qM3r3V3YCXeuwI68K4mqqIhSgnMf2rDto GHhK40bx8WvgyRUy2T1D7KblC3uc0S5AtK8yoGPaa2Xa21v5AknFSpFFaP2xgBmSGLtp 5ENr3TMxK/BUDKMFXrsPl3k0EcKGlt2E3dXXOt3MA9bQjzobP93rGlBZDah0ZS6ALgJp +U/ktXe3GD/4t/+0r5kICh0cii8M5ldc9AUtuPeavH/9Cmx6nq/n9xy7JP0eEi5Weuo2 aFhAFnbIyGryhr99IOqvvKUWzhHRgpshWI7MV9/X2SnmeqUApZxDF8uD3Oh2TD5mvvZ2 gfbg== 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=VM7YehCiJdBA7mC2xp4KECFnV3waxD5wBHvTRenQt6k=; b=Pii9a9K3A3beel9zNBcmhwCBvdBcg7xleFTmSUY6VMfjqxxH0PnCemnrK+8aFq8dNA mY+O2nsqLhHDapfIqA0Fs4EbjKDqTcUja1FIaqnjNvV3E0SZfC0lwQm4ZeARyz17xDvZ E//Yb/Ak+H7HYzj8jc+8gaiFgHXR2+EeZuUnO4BXdETy7G1n3g/WA/GJ6eaKXGptFYqn N+YW1g8N06BLJ5G55dyI833gZOEV20SgmgpuVBMVPQt3rsqHFywXooZpKieuIhH7hVnp av6WgjJkwtNDxbVFkxm9i/tSz8uuQDE6oz2tkS4pDAtR07Awm2T27Xkzz9K0Q5gdACdE l39w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 n13-20020a6546cd000000b0040ca2e84ec2si10761222pgr.84.2022.08.01.02.28.57; Mon, 01 Aug 2022 02:29:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 S229961AbiHAIxD (ORCPT + 99 others); Mon, 1 Aug 2022 04:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbiHAIxA (ORCPT ); Mon, 1 Aug 2022 04:53:00 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B4842F67B for ; Mon, 1 Aug 2022 01:52:58 -0700 (PDT) Received: from dggpemm500024.china.huawei.com (unknown [172.30.72.57]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LxBgc4VbNzGpJY; Mon, 1 Aug 2022 16:51:40 +0800 (CST) Received: from dggpemm500016.china.huawei.com (7.185.36.25) by dggpemm500024.china.huawei.com (7.185.36.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 1 Aug 2022 16:52:56 +0800 Received: from huawei.com (10.67.174.33) by dggpemm500016.china.huawei.com (7.185.36.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 1 Aug 2022 16:52:55 +0800 From: "GONG, Ruiqi" To: Greg Kroah-Hartman , Jiri Slaby CC: , , Subject: [PATCH] tty: moxa: Refine error handling in moxa_pci_probe Date: Mon, 1 Aug 2022 16:53:56 +0800 Message-ID: <20220801085356.1716756-1-gongruiqi1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.33] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm500016.china.huawei.com (7.185.36.25) 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-kernel@vger.kernel.org Add pci_disable_device() into the error handling, and therefore make the function not jump to err if pci_enable_device() failed. Signed-off-by: GONG, Ruiqi --- drivers/tty/moxa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/tty/moxa.c b/drivers/tty/moxa.c index f3c72ab1476c..4432a39331d3 100644 --- a/drivers/tty/moxa.c +++ b/drivers/tty/moxa.c @@ -1239,7 +1239,7 @@ static int moxa_pci_probe(struct pci_dev *pdev, retval = pci_enable_device(pdev); if (retval) { dev_err(&pdev->dev, "can't enable pci device\n"); - goto err; + return retval; } for (i = 0; i < MAX_BOARDS; i++) @@ -1300,6 +1300,7 @@ static int moxa_pci_probe(struct pci_dev *pdev, err_reg: pci_release_region(pdev, 2); err: + pci_disable_device(pdev); return retval; } -- 2.25.1