Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2560246pxb; Mon, 19 Apr 2021 08:26:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQIlv7qE4YGj/4fEu4boyQePyNfOF+Ne6hCCIyqKfXFQMDE/t5rSb6mB7qFqw1rl1ritgg X-Received: by 2002:aa7:dc46:: with SMTP id g6mr26451583edu.342.1618845965008; Mon, 19 Apr 2021 08:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618845965; cv=none; d=google.com; s=arc-20160816; b=KbZADMaWI0E0rZd1kYFfMFXZFQdWqTD4XJU2IbUPDqHhGG5UKanbQSIzsxPxM+/hVX Jh01SVozyH/CxNK0j59LAtcSk4LTrDsFWALvWMgXN5WqJr02FIVZouiNmegdSEV9rT12 SpGZlRAce7LSFpHXnD9LDVZ29TRagm6Wq0WCmL8ZcfOfMwqu2M3UFnhxLZee037TKOZy vvBGubu2elDP4u0xzAzUCyLEAlMDH/Ut/m5WB+G/ulV56V6wu2u8JC9AsoV0GkrYPXao 5sT7AvqYaZ+UaeiUMKq/XTgs9MCqzf1gRkkRltc7ntz5NHy65kgW1y9AChglFaxNgoDv WIvA== 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=3I6nLfzvntg/4TcfLqVu2Kpq1UZ9vV3Rg3Od7Sz1yCE=; b=nsxhdLEsw73BozTsd83FbdBN8AZLibtfgrmLSG8/b60h2EUcZ6wHdeZGjeUdTL2q/f qZ7iaSiZfa/ywnozSgIlamT1L/c/oxOH4BIthfjPAYXiXuSAFKu00UxQ26r3vZmMi+uo DOEhNC9Bclon05MYXiZymgJVumarwfk7a3Nge0squE3mxKUW4N3QYfGOecLcq/9/ddd1 P9n+9yh11RW6Emej9V4JpoZ71na3KM62SvWyHVmXUMuNDc3kx27suPfTohyDiesTH/xd 5/CTH5F6hHb9t9z4MGyYOZPTcmEtxWS0PzRgjcPQKU2ykjoVmfePOobtnUGUD7jngzu2 CYnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=drLZysN0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si4513469edq.266.2021.04.19.08.25.42; Mon, 19 Apr 2021 08:26:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=drLZysN0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240311AbhDSNS4 (ORCPT + 99 others); Mon, 19 Apr 2021 09:18:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:47010 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240404AbhDSNPx (ORCPT ); Mon, 19 Apr 2021 09:15:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AD81D6127C; Mon, 19 Apr 2021 13:13:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618838009; bh=zxkNcddKMUsHiXp2yYbnePjYjDTXeYUPh6UwRyVjd1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=drLZysN0VSU9aUZG0LWftI5T6Yfx0RebUOb+f2/rF0IQANsrYA7N5zkmK2395lMLp CmY6L6ufwn9kk+TVQOWBCxtBU2SaNYAK6lEZxIMQFVl1FW1O5tdsBP92vD/J4+U1+f KwuCBAzoHmkIc/nH2IgzxnIJ2KA36u9uWro1DAic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Logan Gunthorpe , Vinod Koul , Sasha Levin Subject: [PATCH 5.10 011/103] dmaengine: plx_dma: add a missing put_device() on error path Date: Mon, 19 Apr 2021 15:05:22 +0200 Message-Id: <20210419130528.181031299@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210419130527.791982064@linuxfoundation.org> References: <20210419130527.791982064@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 07503e6aefe4a6efd777062191944a14f03b3a18 ] Add a missing put_device(&pdev->dev) if the call to dma_async_device_register(dma); fails. Fixes: 905ca51e63be ("dmaengine: plx-dma: Introduce PLX DMA engine PCI driver skeleton") Signed-off-by: Dan Carpenter Reviewed-by: Logan Gunthorpe Link: https://lore.kernel.org/r/YFnq/0IQzixtAbC1@mwanda Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/plx_dma.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/dma/plx_dma.c b/drivers/dma/plx_dma.c index f387c5bbc170..166934544161 100644 --- a/drivers/dma/plx_dma.c +++ b/drivers/dma/plx_dma.c @@ -507,10 +507,8 @@ static int plx_dma_create(struct pci_dev *pdev) rc = request_irq(pci_irq_vector(pdev, 0), plx_dma_isr, 0, KBUILD_MODNAME, plxdev); - if (rc) { - kfree(plxdev); - return rc; - } + if (rc) + goto free_plx; spin_lock_init(&plxdev->ring_lock); tasklet_setup(&plxdev->desc_task, plx_dma_desc_task); @@ -540,14 +538,20 @@ static int plx_dma_create(struct pci_dev *pdev) rc = dma_async_device_register(dma); if (rc) { pci_err(pdev, "Failed to register dma device: %d\n", rc); - free_irq(pci_irq_vector(pdev, 0), plxdev); - kfree(plxdev); - return rc; + goto put_device; } pci_set_drvdata(pdev, plxdev); return 0; + +put_device: + put_device(&pdev->dev); + free_irq(pci_irq_vector(pdev, 0), plxdev); +free_plx: + kfree(plxdev); + + return rc; } static int plx_dma_probe(struct pci_dev *pdev, -- 2.30.2