public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Osipenko <digetx@gmail.com>
To: Akhil R <akhilrajeev@nvidia.com>,
	dan.j.williams@intel.com, devicetree@vger.kernel.org,
	dmaengine@vger.kernel.org, jonathanh@nvidia.com,
	kyarlagadda@nvidia.com, ldewangan@nvidia.com,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	p.zabel@pengutronix.de, rgumasta@nvidia.com, robh+dt@kernel.org,
	thierry.reding@gmail.com, vkoul@kernel.org
Cc: Pavan Kunapuli <pkunapuli@nvidia.com>
Subject: Re: [PATCH v14 2/4] dmaengine: tegra: Add tegra gpcdma driver
Date: Fri, 10 Dec 2021 00:37:27 +0300	[thread overview]
Message-ID: <a8e55db8-67cf-0706-8770-b89e1282e007@gmail.com> (raw)
In-Reply-To: <1638795639-3681-3-git-send-email-akhilrajeev@nvidia.com>

06.12.2021 16:00, Akhil R пишет:
> +static int tegra_dma_terminate_all(struct dma_chan *dc)
> +{
> +	struct tegra_dma_channel *tdc = to_tegra_dma_chan(dc);
> +	unsigned long wcount = 0;
> +	unsigned long status;
> +	unsigned long flags;
> +	int err;
> +
> +	raw_spin_lock_irqsave(&tdc->lock, flags);
> +
> +	if (!tdc->dma_desc) {
> +		raw_spin_unlock_irqrestore(&tdc->lock, flags);
> +		return 0;
> +	}
> +
> +	if (!tdc->busy)
> +		goto skip_dma_stop;
> +
> +	if (tdc->tdma->chip_data->hw_support_pause)
> +		err = tegra_dma_pause(tdc);
> +	else
> +		err = tegra_dma_stop_client(tdc);
> +
> +	if (err) {
> +		raw_spin_unlock_irqrestore(&tdc->lock, flags);
> +		return err;
> +	}
> +
> +	status = tdc_read(tdc, TEGRA_GPCDMA_CHAN_STATUS);
> +	if (status & TEGRA_GPCDMA_STATUS_ISE_EOC) {
> +		dev_dbg(tdc2dev(tdc), "%s():handling isr\n", __func__);
> +		tegra_dma_xfer_complete(tdc);
> +		status = tdc_read(tdc, TEGRA_GPCDMA_CHAN_STATUS);
> +	}
> +
> +	wcount = tdc_read(tdc, TEGRA_GPCDMA_CHAN_XFER_COUNT);
> +	tegra_dma_stop(tdc);
> +
> +	tdc->dma_desc->bytes_transferred +=
> +			tdc->dma_desc->bytes_requested - (wcount * 4);
> +
> +skip_dma_stop:
> +	tegra_dma_sid_free(tdc);
> +	kfree(tdc->dma_desc);

This kfree looks very suspicious. It should be on the tdc->vc list
AFAICS, secondly I don't think that driver can be considered the owner
of the descriptor.

> +	vchan_free_chan_resources(&tdc->vc);


  parent reply	other threads:[~2021-12-09 21:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 13:00 [PATCH v14 0/4] Add NVIDIA Tegra GPC-DMA driver Akhil R
2021-12-06 13:00 ` [PATCH v14 1/4] dt-bindings: dmaengine: Add doc for tegra gpcdma Akhil R
2021-12-10 16:44   ` Rob Herring
2021-12-06 13:00 ` [PATCH v14 2/4] dmaengine: tegra: Add tegra gpcdma driver Akhil R
2021-12-09 17:10   ` Thierry Reding
2021-12-09 21:19   ` Dmitry Osipenko
2021-12-09 21:23   ` Dmitry Osipenko
2021-12-15 13:50     ` Akhil R
2021-12-15 14:56       ` Dmitry Osipenko
2021-12-09 21:26   ` Dmitry Osipenko
2021-12-09 21:37   ` Dmitry Osipenko [this message]
2021-12-06 13:00 ` [PATCH v14 3/4] arm64: defconfig: tegra: Enable GPCDMA Akhil R
2021-12-06 13:00 ` [PATCH v14 4/4] arm64: tegra: Add GPCDMA node for tegra186 and tegra194 Akhil R

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=a8e55db8-67cf-0706-8770-b89e1282e007@gmail.com \
    --to=digetx@gmail.com \
    --cc=akhilrajeev@nvidia.com \
    --cc=dan.j.williams@intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kyarlagadda@nvidia.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=pkunapuli@nvidia.com \
    --cc=rgumasta@nvidia.com \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=vkoul@kernel.org \
    /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