From: Dan Carpenter <dan.carpenter@oracle.com>
To: Doug Anderson <dianders@chromium.org>
Cc: Shawn Lin <shawn.lin@rock-chips.com>,
Mark Brown <broonie@kernel.org>,
linux-spi@vger.kernel.org,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"open list:ARM/Rockchip SoC..."
<linux-rockchip@lists.infradead.org>
Subject: Re: [PATCH 3/3] spi: rockchip: check requesting dma channel with EPROBE_DEFER
Date: Tue, 22 Mar 2016 14:59:56 +0300 [thread overview]
Message-ID: <20160322115956.GY5273@mwanda> (raw)
In-Reply-To: <CAD=FV=Wi9SEtM+o4AEPW6kpuGU+NH1uhW9hk5OQ5U8inyr1y1w@mail.gmail.com>
On Mon, Mar 21, 2016 at 04:33:32PM -0700, Doug Anderson wrote:
> Presumably Dan would be happy if you just add this right after the dev_warn():
> rs->dma_tx.ch = NULL;
>
Yes. Thanks.
> Presumably from Dan's email it would also be wise to make sure you
> don't pass NULL to PTR_ERR, which you could probably do by just using
> ERR_PTR instead of PTR_ERR. I think you could structure like this:
>
> rs->dma_tx.ch = dma_request_slave_channel(rs->dev, "tx");
> - if (!rs->dma_tx.ch)
> + if (IS_ERR_OR_NULL(rs->dma_tx.ch)) {
> + /* Check tx to see if we need defer probing driver */
> + if (rs->dma_tx.ch == ERR_PTR(-EPROBE_DEFER)) {
> + ret = -EPROBE_DEFER;
> + goto err_get_fifo_len;
> + }
> dev_warn(rs->dev, "Failed to request TX DMA channel\n");
> + rs->dma_tx.ch = NULL;
> + }
My check doesn't care if you pass something to PTR_ERR() that might be
NULL, it complains when PTR_ERR() can only be zero. And it's ok to have
the warning for a while and silence it in another patch when we update
dma_request_slave_channel().
But this also works well.
regards,
dan carpenter
prev parent reply other threads:[~2016-03-22 12:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 8:10 [PATCH 0/3] Some fixes for slave-dma stuff for spi-rockchip Shawn Lin
2016-03-09 8:11 ` [PATCH 1/3] spi: rockchip: check return value of dmaengine_prep_slave_sg Shawn Lin
2016-03-09 8:11 ` [PATCH 2/3] spi: rockchip: migrate to dmaengine_terminate_async Shawn Lin
2016-03-09 8:11 ` [PATCH 3/3] spi: rockchip: check requesting dma channel with EPROBE_DEFER Shawn Lin
2016-03-21 23:33 ` Doug Anderson
2016-03-22 2:03 ` Shawn Lin
2016-03-22 2:33 ` Doug Anderson
2016-03-22 2:53 ` Shawn Lin
2016-03-22 3:33 ` Doug Anderson
2016-03-22 13:12 ` Vladimir Zapolskiy
2016-04-05 18:08 ` Vinod Koul
2016-03-22 11:59 ` Dan Carpenter [this message]
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=20160322115956.GY5273@mwanda \
--to=dan.carpenter@oracle.com \
--cc=broonie@kernel.org \
--cc=dianders@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=shawn.lin@rock-chips.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