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 4D9ACC433F5 for ; Tue, 15 Feb 2022 07:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233528AbiBOHqU (ORCPT ); Tue, 15 Feb 2022 02:46:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbiBOHqT (ORCPT ); Tue, 15 Feb 2022 02:46:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B258A107DBD; Mon, 14 Feb 2022 23:46:09 -0800 (PST) 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 189A0B80E70; Tue, 15 Feb 2022 07:46:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BE8EC340EC; Tue, 15 Feb 2022 07:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644911166; bh=3lB9kUJK8jxkLP3rCA6Ubvf8NJBzKM22raR92qKTb/0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uZ9GS4jrDWdg/MMzlceTdBPLLQ8sJQojB5NiM7B2LKAacCoxsnX/ByWyu4doEst0F z0NA2B29/k/O9GoagQtITR9jTgXqvTB9RCdWlithxAj2sejbQRNv4/jwtEEgOaVNuc OwkNikfdjuNXCPbyFin6x/H6xzY7Wr9Bw0JOoANE= Date: Tue, 15 Feb 2022 08:46:03 +0100 From: Greg Kroah-Hartman To: Qing Wang Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tty: serial: add missing pci_dev_put() before return Message-ID: References: <1644890472-65306-1-git-send-email-wangqing@vivo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1644890472-65306-1-git-send-email-wangqing@vivo.com> Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org On Mon, Feb 14, 2022 at 06:01:12PM -0800, 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/pch_uart.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c > index f0351e6..da5a276 > --- a/drivers/tty/serial/pch_uart.c > +++ b/drivers/tty/serial/pch_uart.c > @@ -723,7 +723,7 @@ static void pch_request_dma(struct uart_port *port) > if (!chan) { > dev_err(priv->port.dev, "%s:dma_request_channel FAILS(Tx)\n", > __func__); > - return; > + goto out; > } > priv->chan_tx = chan; > > @@ -739,13 +739,16 @@ static void pch_request_dma(struct uart_port *port) > __func__); > dma_release_channel(priv->chan_tx); > priv->chan_tx = NULL; > - return; > + goto out; > } > > /* Get Consistent memory for DMA */ > priv->rx_buf_virt = dma_alloc_coherent(port->dev, port->fifosize, > &priv->rx_buf_dma, GFP_KERNEL); > priv->chan_rx = chan; > + > +out: > + pci_dev_put(dma_dev); > } > > static void pch_dma_rx_complete(void *arg) > -- > 2.7.4 > What tool are you using to find these? As Jiri points out, it is not very correct at all, be careful to not cause bugs when you are attempting to fix them. For stuff like this, please always test your changes to verify they work. thanks, greg k-h