Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp984394pxb; Wed, 6 Apr 2022 06:03:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE8IylgtwPC6zIOyfRugIIac7mcChrH2Z/G+5aDxwRBtoczk/ilPpbaYhIIKCgA4I/h2aj X-Received: by 2002:a63:3185:0:b0:382:623b:3c84 with SMTP id x127-20020a633185000000b00382623b3c84mr7122977pgx.479.1649250181556; Wed, 06 Apr 2022 06:03:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649250181; cv=none; d=google.com; s=arc-20160816; b=YxyAEmSRj+ZQAMKg7n16C2TuGs43bFZSnoWmBGvribcuTBuIlD39RAA2KnPFpZR0Ye fNASt6/kNJlEq3+veztSfVe36E6wNzWvBrTnrh99g9IyBPV/T3qbxIiM+WhAGjttMNhM 2eOBAWBSFjOUMwOtLHROLM1bKODX3dyjB5GmgobGbqmjVw+F7V7JmRB91mAxC+LI8ydP uMPwKo8KrpITEy62UnO0UM/7pFIIVh2Y0Bt1HUyuSmbXglaLK7pIpBUgwc12K/JyTgvw e8Mz2RVqXZJb6ivbJN7DrctOg/rK+iJ4tffKIkipPPbiL8NkwTF51nukuCnQ/mFbvbYB WJ1Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sF5iD2S3y1cJPO5+6ZkgLIJAFaWvC2l1F+VZZBVMGPY=; b=meZ/8vmMfdIomlGjg4SIpdOU5Hj9VWLek1pw2aA0kAZwfqLJFE/VOFjLCAoI/zubtq 7CF9fmj9BhnNFca3ZCIu6oK1mmfosVFTWc2LHRWdLncCAI3cGP2l09r6/lFh1N2bsDUh jbOw21cKhR/TGsV1Cg82kOIZE1UPxUuxlxcUMYWhRH9hIjqpibHXBkehpNiKtDQu+jmB 9K1ecLIHjCuVIWfCWYPphqYhDhVw1Z0lZPNLOAhsEcyCUna6N8UBeRyZCQUH1tlBedRf OsVR1N0s3VasbUXxmwsVV0SRPiZG7E6rnN4hrOeNhJKBciBQQqUZ6HY1SCuOrzJcIO7k oLXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x1MuDJkY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z13-20020a63e10d000000b003822812b5f3si15067133pgh.568.2022.04.06.06.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:03:01 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=x1MuDJkY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE77E4739FD; Wed, 6 Apr 2022 03:21:09 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1842932AbiDFBf1 (ORCPT + 99 others); Tue, 5 Apr 2022 21:35:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349434AbiDEJtw (ORCPT ); Tue, 5 Apr 2022 05:49:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C1325E97; Tue, 5 Apr 2022 02:45:53 -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 4BF39B817D3; Tue, 5 Apr 2022 09:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5DC3C385A1; Tue, 5 Apr 2022 09:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649151951; bh=KoGQ+0vWP49KzgTOCU/ifdDn7F7KOjvEzSHR2vQTS+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x1MuDJkYW2q1tpPdxP80e5zm+yMzAGsnLMqxHyCWRBgCiKeIxkabFV2mPxeSI4quT wyM8AoZ3KnetI3YQJpsgyCjZYlg/Pr2Q5Sl1Eb+hI1QbSfqanODojO1aKcIYeXxyGy x7tYMH7o5EM0htBmYQVbHoJP1LLj2L7/tV5UoNRM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qing Wang , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.15 600/913] serial: 8250_mid: Balance reference count for PCI DMA device Date: Tue, 5 Apr 2022 09:27:42 +0200 Message-Id: <20220405070357.827072214@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Andy Shevchenko [ Upstream commit 67ec6dd0b257bd81b4e9fcac89b29da72f6265e5 ] The pci_get_slot() increases its reference count, the caller must decrement the reference count by calling pci_dev_put(). Fixes: 90b9aacf912a ("serial: 8250_pci: add Intel Tangier support") Fixes: f549e94effa1 ("serial: 8250_pci: add Intel Penwell ports") Reported-by: Qing Wang Signed-off-by: Andy Shevchenko Depends-on: d9eda9bab237 ("serial: 8250_pci: Intel MID UART support to its own driver") Link: https://lore.kernel.org/r/20220215100920.41984-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/tty/serial/8250/8250_mid.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c index efa0515139f8..e6c1791609dd 100644 --- a/drivers/tty/serial/8250/8250_mid.c +++ b/drivers/tty/serial/8250/8250_mid.c @@ -73,6 +73,11 @@ static int pnw_setup(struct mid8250 *mid, struct uart_port *p) return 0; } +static void pnw_exit(struct mid8250 *mid) +{ + pci_dev_put(mid->dma_dev); +} + static int tng_handle_irq(struct uart_port *p) { struct mid8250 *mid = p->private_data; @@ -124,6 +129,11 @@ static int tng_setup(struct mid8250 *mid, struct uart_port *p) return 0; } +static void tng_exit(struct mid8250 *mid) +{ + pci_dev_put(mid->dma_dev); +} + static int dnv_handle_irq(struct uart_port *p) { struct mid8250 *mid = p->private_data; @@ -330,9 +340,9 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) pci_set_drvdata(pdev, mid); return 0; + err: - if (mid->board->exit) - mid->board->exit(mid); + mid->board->exit(mid); return ret; } @@ -342,8 +352,7 @@ static void mid8250_remove(struct pci_dev *pdev) serial8250_unregister_port(mid->line); - if (mid->board->exit) - mid->board->exit(mid); + mid->board->exit(mid); } static const struct mid8250_board pnw_board = { @@ -351,6 +360,7 @@ static const struct mid8250_board pnw_board = { .freq = 50000000, .base_baud = 115200, .setup = pnw_setup, + .exit = pnw_exit, }; static const struct mid8250_board tng_board = { @@ -358,6 +368,7 @@ static const struct mid8250_board tng_board = { .freq = 38400000, .base_baud = 1843200, .setup = tng_setup, + .exit = tng_exit, }; static const struct mid8250_board dnv_board = { -- 2.34.1