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 X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26A18C4332E for ; Thu, 7 Jan 2021 14:32:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F2A9723356 for ; Thu, 7 Jan 2021 14:32:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729336AbhAGOc1 (ORCPT ); Thu, 7 Jan 2021 09:32:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:45832 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729279AbhAGOcS (ORCPT ); Thu, 7 Jan 2021 09:32:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AC21F2336D; Thu, 7 Jan 2021 14:31:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610029916; bh=ej44jCxgDX+vbHLUV3UbuB+X4ZwVfwGfzDKw4seP660=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WNvZUaPLkerHEX3DwpyVci+ptQaMK2PbBRJGMcR1fmf8yKRC+ytdpxWnp0gaiN/Vr hEHZmsYM6MdWvaX9VnG1LF+cXnzSRaFkFgCwS/yxzxgR4+vvPexgGiNTa7Cmk8/qUi BXHtH/PskdES2vM9E2LZJH6g21hqnDn1zpbW885c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Vinod Koul Subject: [PATCH 4.19 3/8] dmaengine: at_hdmac: add missing put_device() call in at_dma_xlate() Date: Thu, 7 Jan 2021 15:32:03 +0100 Message-Id: <20210107143048.026966771@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210107143047.586006010@linuxfoundation.org> References: <20210107143047.586006010@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: Yu Kuai commit 3832b78b3ec2cf51e07102f9b4480e343459b20f upstream. If of_find_device_by_node() succeed, at_dma_xlate() doesn't have a corresponding put_device(). Thus add put_device() to fix the exception handling for this function implementation. Fixes: bbe89c8e3d59 ("at_hdmac: move to generic DMA binding") Signed-off-by: Yu Kuai Link: https://lore.kernel.org/r/20200817115728.1706719-3-yukuai3@huawei.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/at_hdmac.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -1684,8 +1684,10 @@ static struct dma_chan *at_dma_xlate(str dma_cap_set(DMA_SLAVE, mask); atslave = kmalloc(sizeof(*atslave), GFP_KERNEL); - if (!atslave) + if (!atslave) { + put_device(&dmac_pdev->dev); return NULL; + } atslave->cfg = ATC_DST_H2SEL_HW | ATC_SRC_H2SEL_HW; /* @@ -1714,8 +1716,10 @@ static struct dma_chan *at_dma_xlate(str atslave->dma_dev = &dmac_pdev->dev; chan = dma_request_channel(mask, at_dma_filter, atslave); - if (!chan) + if (!chan) { + put_device(&dmac_pdev->dev); return NULL; + } atchan = to_at_dma_chan(chan); atchan->per_if = dma_spec->args[0] & 0xff;