linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Yu Kuai <yukuai3@huawei.com>,
	Vinod Koul <vkoul@kernel.org>
Subject: [PATCH 5.4 04/13] dmaengine: at_hdmac: add missing put_device() call in at_dma_xlate()
Date: Thu,  7 Jan 2021 15:33:23 +0100	[thread overview]
Message-ID: <20210107143050.505932032@linuxfoundation.org> (raw)
In-Reply-To: <20210107143049.929352526@linuxfoundation.org>

From: Yu Kuai <yukuai3@huawei.com>

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 <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20200817115728.1706719-3-yukuai3@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 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
@@ -1674,8 +1674,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;
 	/*
@@ -1704,8 +1706,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;



  parent reply	other threads:[~2021-01-07 14:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 14:33 [PATCH 5.4 00/13] 5.4.88-rc1 review Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 01/13] Revert "drm/amd/display: Fix memory leaks in S3 resume" Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 02/13] Revert "mtd: spinand: Fix OOB read" Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 03/13] dmaengine: at_hdmac: Substitute kzalloc with kmalloc Greg Kroah-Hartman
2021-01-07 14:33 ` Greg Kroah-Hartman [this message]
2021-01-07 14:33 ` [PATCH 5.4 05/13] dmaengine: at_hdmac: add missing kfree() call in at_dma_xlate() Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 06/13] kdev_t: always inline major/minor helper functions Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 07/13] iio:imu:bmi160: Fix alignment and data leak issues Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 08/13] fuse: fix bad inode Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 09/13] perf: Break deadlock involving exec_update_mutex Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 10/13] rwsem: Implement down_read_killable_nested Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 11/13] rwsem: Implement down_read_interruptible Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 12/13] exec: Transform exec_update_mutex into a rw_semaphore Greg Kroah-Hartman
2021-01-07 14:33 ` [PATCH 5.4 13/13] mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start Greg Kroah-Hartman
2021-01-08  1:11 ` [PATCH 5.4 00/13] 5.4.88-rc1 review Shuah Khan
2021-01-08  2:28 ` Naresh Kamboju
2021-01-08 17:39 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210107143050.505932032@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=vkoul@kernel.org \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).