[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a8e55db8-67cf-0706-8770-b89e1282e007@gmail.com>
Date: Fri, 10 Dec 2021 00:37:27 +0300
From: Dmitry Osipenko <digetx@...il.com>
To: Akhil R <akhilrajeev@...dia.com>, dan.j.williams@...el.com,
devicetree@...r.kernel.org, dmaengine@...r.kernel.org,
jonathanh@...dia.com, kyarlagadda@...dia.com, ldewangan@...dia.com,
linux-kernel@...r.kernel.org, linux-tegra@...r.kernel.org,
p.zabel@...gutronix.de, rgumasta@...dia.com, robh+dt@...nel.org,
thierry.reding@...il.com, vkoul@...nel.org
Cc: Pavan Kunapuli <pkunapuli@...dia.com>
Subject: Re: [PATCH v14 2/4] dmaengine: tegra: Add tegra gpcdma driver
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);
Powered by blists - more mailing lists