* [bug report] dmaengine: break out channel registration
@ 2020-01-31 5:00 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2020-01-31 5:00 UTC (permalink / raw)
To: dave.jiang; +Cc: dmaengine
Hello Dave Jiang,
The patch d2fb0a043838: "dmaengine: break out channel registration"
from Jan 21, 2020, leads to the following static checker warning:
drivers/dma/dmaengine.c:965 __dma_async_device_channel_register()
error: potential NULL dereference 'tchan'.
drivers/dma/dmaengine.c
954 static int __dma_async_device_channel_register(struct dma_device *device,
955 struct dma_chan *chan,
956 int chan_id)
957 {
958 int rc = 0;
959 int chancnt = device->chancnt;
960 atomic_t *idr_ref;
961 struct dma_chan *tchan;
962
963 tchan = list_first_entry_or_null(&device->channels,
^^^^^^^^
The "or_null" suggests that "tchan" can be NULL
964 struct dma_chan, device_node);
965 if (tchan->dev) {
^^^^^^^^^^
so this should be "if (tchan && tchan->dev)"?
966 idr_ref = tchan->dev->idr_ref;
967 } else {
968 idr_ref = kmalloc(sizeof(*idr_ref), GFP_KERNEL);
969 if (!idr_ref)
970 return -ENOMEM;
971 atomic_set(idr_ref, 0);
972 }
973
974 chan->local = alloc_percpu(typeof(*chan->local));
975 if (!chan->local)
976 goto err_out;
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-01-31 5:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 5:00 [bug report] dmaengine: break out channel registration Dan Carpenter
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).