From: Peter Ujfalusi <peter.ujfalusi@ti.com>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Vinod <vkoul@kernel.org>, <dmaengine@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dan Williams <dan.j.williams@intel.com>
Subject: Re: [PATCH 1/2] dmaengine: Cleanups for the slave <-> channel symlink support
Date: Fri, 31 Jan 2020 09:14:22 +0200 [thread overview]
Message-ID: <fef9eeac-f088-61e8-eecc-a106a6f09224@ti.com> (raw)
In-Reply-To: <CAMuHMdUdhqRU8NmHrcgKQpiVDsuFosWUykZs47HdF9RRCDv-KA@mail.gmail.com>
Hi Geert,
On 30/01/2020 17.20, Geert Uytterhoeven wrote:
> Hi Peter,
>
> On Thu, Jan 30, 2020 at 12:41 PM Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
>> No need to use goto to jump over the
>> return chan ? chan : ERR_PTR(-EPROBE_DEFER);
>> We can just revert the check and return right there.
>>
>> Do not fail the channel request if the chan->name allocation fails, but
>> print a warning about it.
>>
>> Change the dev_err to dev_warn if sysfs_create_link() fails as it is not
>> fatal.
>>
>> Only attempt to remove the DMA_SLAVE_NAME symlink if it is created - or it
>> was attempted to be created.
>>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>
> Thanks for your patch!
>
>> --- a/drivers/dma/dmaengine.c
>> +++ b/drivers/dma/dmaengine.c
>> @@ -756,22 +756,24 @@ struct dma_chan *dma_request_chan(struct device *dev, const char *name)
>> }
>> mutex_unlock(&dma_list_mutex);
>>
>> - if (!IS_ERR_OR_NULL(chan))
>> - goto found;
>> -
>> - return chan ? chan : ERR_PTR(-EPROBE_DEFER);
>> + if (IS_ERR_OR_NULL(chan))
>> + return chan ? chan : ERR_PTR(-EPROBE_DEFER);
>>
>> found:
>> - chan->slave = dev;
>> chan->name = kasprintf(GFP_KERNEL, "dma:%s", name);
>> - if (!chan->name)
>> - return ERR_PTR(-ENOMEM);
>> + if (!chan->name) {
>> + dev_warn(dev,
>> + "Cannot allocate memory for slave symlink name\n");
>
> No need to print a message, as the memory allocator core will have
> screamed already.
Right, I tend to forget this ;)
>
>> + return chan;
>> + }
>> + chan->slave = dev;
>>
>> if (sysfs_create_link(&chan->dev->device.kobj, &dev->kobj,
>> DMA_SLAVE_NAME))
>> - dev_err(dev, "Cannot create DMA %s symlink\n", DMA_SLAVE_NAME);
>> + dev_warn(dev, "Cannot create DMA %s symlink\n", DMA_SLAVE_NAME);
>> if (sysfs_create_link(&dev->kobj, &chan->dev->device.kobj, chan->name))
>> - dev_err(dev, "Cannot create DMA %s symlink\n", chan->name);
>> + dev_warn(dev, "Cannot create DMA %s symlink\n", chan->name);
>> +
>> return chan;
>> }
>> EXPORT_SYMBOL_GPL(dma_request_chan);
>
> With the above fixed:
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Thanks,
- Péter
>
> Gr{oetje,eeting}s,
>
> Geert
>
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
next prev parent reply other threads:[~2020-01-31 7:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-30 11:42 [PATCH 0/2] dmaengine: Cleanups for symlink handling and debugfs support Peter Ujfalusi
2020-01-30 11:42 ` [PATCH 1/2] dmaengine: Cleanups for the slave <-> channel symlink support Peter Ujfalusi
2020-01-30 15:20 ` Geert Uytterhoeven
2020-01-31 7:14 ` Peter Ujfalusi [this message]
2020-01-30 11:42 ` [PATCH 2/2] dmaengine: Add basic debugfs support Peter Ujfalusi
2020-01-30 15:42 ` Geert Uytterhoeven
2020-01-31 8:29 ` Peter Ujfalusi
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=fef9eeac-f088-61e8-eecc-a106a6f09224@ti.com \
--to=peter.ujfalusi@ti.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).