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 CAD9FC433EF for ; Tue, 15 Feb 2022 06:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232512AbiBOGDK (ORCPT ); Tue, 15 Feb 2022 01:03:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbiBOGDJ (ORCPT ); Tue, 15 Feb 2022 01:03:09 -0500 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73F13B716A; Mon, 14 Feb 2022 22:03:00 -0800 (PST) Received: by mail-ej1-f52.google.com with SMTP id qk11so21560314ejb.2; Mon, 14 Feb 2022 22:03:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:references:in-reply-to :content-transfer-encoding; bh=m/+GWq7LGPjn6L3TlGLfnYbRWnVKngkEcYqskuqOhA4=; b=4M5sgZS04S0gcHTSLfDQwi3pdk1yrLGYURwUoRcY8wdwoCHwrfW/H//ftgWv+o5j3N R4c4a8UXP/BEKn17hsAqE1keTKg7KaWuI44eObDSKs65IOS9DM72KYwK9TuCQI+oFid+ nfcfNkfMJhUI2imDZchc5vakgrZaHIH8KuHn3x3zajSzzjidMG/Lr5OSXhHujS/PAVES rr1bFOga/yAlldsYbOFolOl4llTd9GoWhty5UWMP/zMEpXdqzIoGcf0yMbWPhUH11hXT wqPZ6TOnGxNCJqPeJ0E0iehjkgYaTYl0DR4cmg+kB82HCUO3KRp/kBh79jVKVq6ysB1k Cu3g== X-Gm-Message-State: AOAM533lHcXNimA8jbVqJfVJXLZDBWoTEOsEa8t0TTwex0hvkcTSDtj2 F2VHwwSB754U9i6ix3mt4XA= X-Google-Smtp-Source: ABdhPJwbXMZT0RA9BZurHDr47BqekBgRBAtuwCP+LWOn/a1Eqe9/WxyjJQ/QPlk8dsnOlZPfOkwhqA== X-Received: by 2002:a17:906:9b93:: with SMTP id dd19mr1704122ejc.308.1644904979061; Mon, 14 Feb 2022 22:02:59 -0800 (PST) Received: from ?IPV6:2a0b:e7c0:0:107::49? ([2a0b:e7c0:0:107::49]) by smtp.gmail.com with ESMTPSA id tc26sm1451637ejc.167.2022.02.14.22.02.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 14 Feb 2022 22:02:58 -0800 (PST) Message-ID: <621e2079-567c-6954-9744-c51748dd48dd@kernel.org> Date: Tue, 15 Feb 2022 07:02:57 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH] tty: serial: 8250: add missing pci_dev_put() before return Content-Language: en-US From: Jiri Slaby To: Qing Wang , Andy Shevchenko , Greg Kroah-Hartman , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org References: <1644890454-65258-1-git-send-email-wangqing@vivo.com> <67ace5d3-02b3-034d-969f-9a05bbdd8e30@kernel.org> In-Reply-To: <67ace5d3-02b3-034d-969f-9a05bbdd8e30@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org On 15. 02. 22, 6:55, Jiri Slaby wrote: > On 15. 02. 22, 3:00, Qing Wang wrote: >> From: Wang Qing >> >> pci_get_slot() increases its reference count, the caller must >> decrement the reference count by calling pci_dev_put() >> >> Signed-off-by: Wang Qing >> --- >>   drivers/tty/serial/8250/8250_lpss.c | 2 ++ >>   1 file changed, 2 insertions(+) >> >> diff --git a/drivers/tty/serial/8250/8250_lpss.c >> b/drivers/tty/serial/8250/8250_lpss.c >> index d3bafec..57e462f >> --- a/drivers/tty/serial/8250/8250_lpss.c >> +++ b/drivers/tty/serial/8250/8250_lpss.c >> @@ -149,6 +149,8 @@ static int byt_serial_setup(struct lpss8250 *lpss, >> struct uart_port *port) >>       /* Disable TX counter interrupts */ >>       writel(BYT_TX_OVF_INT_MASK, port->membase + BYT_TX_OVF_INT); >> +    pci_dev_put(dma_dev); > > > What about the "return -ENODEV" few lines above? On the top of that, the code stores the pointer to the dev: param->dma_dev = &dma_dev->dev; So we should likely put the device in ->exit(), not ->setup(). thanks, -- js suse labs