Message ID | 20130819052516.GT32147@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
> No, this is not the right approach. > > When patch is applied and you find an issue you fix the issue. I have already > pushed and merged this. So removing is a bad idea. > you provide a fix for this miss. > > Also for this you need to give due credit to Dan (reporter). That is how the > process works. > > Anyway I have applied the below fix and will push it out. > > --- > dmaengine: fix - error: potential NULL dereference 'chan' > > commit 7bb587f4 "dmaengine: add interface of dma_get_slave_channel" introduced > the above error so fix it > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > Suggested-by: Zhangfei Gao <zhangfei.gao@linaro.org> > Signed-off-by: Vinod Koul <vinod.koul@intel.com> Thanks Vinod for the kind education. Understand, will take care next time. BTW, it is strange I do not see such compile warning here :(
On Tue, Aug 20, 2013 at 03:58:41PM +0800, zhangfei gao wrote:
> BTW, it is strange I do not see such compile warning here :(
This was a Smatch static checker warning, not a regular build
warning.
regards,
dan carpenter
On Tue, Aug 20, 2013 at 03:58:41PM +0800, zhangfei gao wrote: > > No, this is not the right approach. > > > > When patch is applied and you find an issue you fix the issue. I have already > > pushed and merged this. So removing is a bad idea. > > you provide a fix for this miss. > > > > Also for this you need to give due credit to Dan (reporter). That is how the > > process works. > > > > Anyway I have applied the below fix and will push it out. > > > > --- > > dmaengine: fix - error: potential NULL dereference 'chan' > > > > commit 7bb587f4 "dmaengine: add interface of dma_get_slave_channel" introduced > > the above error so fix it > > > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > > Suggested-by: Zhangfei Gao <zhangfei.gao@linaro.org> > > Signed-off-by: Vinod Koul <vinod.koul@intel.com> > > Thanks Vinod for the kind education. > Understand, will take care next time. No issues... > > BTW, it is strange I do not see such compile warning here :( Try running smatch and you will see. Compiler will not worry about these, static checkers would. Since the bug report is from Dan, my guess is it would be triggered by Smatch. ~Vinod
On Tue, Aug 20, 2013 at 11:13:48AM +0300, Dan Carpenter wrote: > On Tue, Aug 20, 2013 at 03:58:41PM +0800, zhangfei gao wrote: > > > BTW, it is strange I do not see such compile warning here :( > > This was a Smatch static checker warning, not a regular build > warning. my guess was right! ~Vinod
On 13-08-20 04:13 PM, Dan Carpenter wrote: > On Tue, Aug 20, 2013 at 03:58:41PM +0800, zhangfei gao wrote: > >> BTW, it is strange I do not see such compile warning here :( > > This was a Smatch static checker warning, not a regular build > warning. > > regards, > dan carpenter > Dear Dan Thanks for introducing this valuable tool. Have download from git://repo.or.cz/smatch.git When trying use this tool, could get some warning, make CHECK="~/bin/smatch -p=kernel --no-data" C=1 | tee warns.txt Also some strange warning, like "SQL error #2: no such table: caller_info", is it ignored? Besides, when test this case for check smatch setting. Still not reproduce the issue, should be not config correct? Only get drivers/dma/dmaengine.c:845 dma_async_device_register() warn: possible memory leak of 'idr_ref' drivers/dma/dmaengine.c:866 dma_async_device_register() warn: possible memory leak of 'idr_ref' Anyway, though config not totally correct, it really could find some warning. Thanks
On Tue, Aug 27, 2013 at 10:04:48AM +0800, zhangfei wrote: > On 13-08-20 04:13 PM, Dan Carpenter wrote: > >On Tue, Aug 20, 2013 at 03:58:41PM +0800, zhangfei gao wrote: > > > >>BTW, it is strange I do not see such compile warning here :( > > > >This was a Smatch static checker warning, not a regular build > >warning. > > > >regards, > >dan carpenter > > > Dear Dan > > Thanks for introducing this valuable tool. > Have download from git://repo.or.cz/smatch.git > > When trying use this tool, could get some warning, > make CHECK="~/bin/smatch -p=kernel --no-data" C=1 | tee warns.txt > > Also some strange warning, like "SQL error #2: no such table: > caller_info", is it ignored? > Oops. I'll fix that. The problem is that I don't normally test with --no-data. Sorry about that. > Besides, when test this case for check smatch setting. > Still not reproduce the issue, should be not config correct? This warning requires that the cross function database be set up. regards, dan carpenter
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c index 5932ab1..755ba2f 100644 --- a/drivers/dma/dmaengine.c +++ b/drivers/dma/dmaengine.c @@ -514,16 +514,16 @@ struct dma_chan *dma_get_slave_channel(struct dma_chan *chan) /* lock against __dma_request_channel */ mutex_lock(&dma_list_mutex); - if (chan->client_count == 0) + if (chan->client_count == 0) { err = dma_chan_get(chan); - else + if (err) + pr_debug("%s: failed to get %s: (%d)\n", + __func__, dma_chan_name(chan), err); + } else chan = NULL; mutex_unlock(&dma_list_mutex); - if (err) - pr_debug("%s: failed to get %s: (%d)\n", - __func__, dma_chan_name(chan), err); return chan; }