Commit 70b9b24d authored by Sachin Kamat's avatar Sachin Kamat Committed by Kukjin Kim

ARM: S3C24XX: Fix potential NULL pointer dereference error

chan->end is tested for being NULL. However in the event that it is NULL, the
subsequent assignment statement would lead to NULL pointer dereference.
Thus dereferencing it only when it is not NULL.
Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: default avatarKukjin Kim <kgene.kim@samsung.com>
parent f4a75d2e
...@@ -473,13 +473,14 @@ int s3c2410_dma_enqueue(enum dma_ch channel, void *id, ...@@ -473,13 +473,14 @@ int s3c2410_dma_enqueue(enum dma_ch channel, void *id,
pr_debug("dma%d: %s: buffer %p queued onto non-empty channel\n", pr_debug("dma%d: %s: buffer %p queued onto non-empty channel\n",
chan->number, __func__, buf); chan->number, __func__, buf);
if (chan->end == NULL) if (chan->end == NULL) {
pr_debug("dma%d: %s: %p not empty, and chan->end==NULL?\n", pr_debug("dma%d: %s: %p not empty, and chan->end==NULL?\n",
chan->number, __func__, chan); chan->number, __func__, chan);
} else {
chan->end->next = buf; chan->end->next = buf;
chan->end = buf; chan->end = buf;
} }
}
/* if necessary, update the next buffer field */ /* if necessary, update the next buffer field */
if (chan->next == NULL) if (chan->next == NULL)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment