[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160322115956.GY5273@mwanda>
Date: Tue, 22 Mar 2016 14:59:56 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Doug Anderson <dianders@...omium.org>
Cc: Shawn Lin <shawn.lin@...k-chips.com>,
Mark Brown <broonie@...nel.org>, linux-spi@...r.kernel.org,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"open list:ARM/Rockchip SoC..." <linux-rockchip@...ts.infradead.org>
Subject: Re: [PATCH 3/3] spi: rockchip: check requesting dma channel with
EPROBE_DEFER
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
Powered by blists - more mailing lists