All of lore.kernel.org
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dmaengine@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] dmaengine: k3dma: Adjust six checks for null pointers
Date: Sun, 23 Apr 2017 11:09:19 +0200	[thread overview]
Message-ID: <12cb50fb-63b7-8127-700d-1fe1c75c3961@users.sourceforge.net> (raw)
In-Reply-To: <f83beedc-28fd-c373-cca8-7261e42577a5@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Apr 2017 10:47:04 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/dma/k3dma.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index 31a51ee1a910..da20565f7a8d 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -230,7 +230,7 @@ static irqreturn_t k3_dma_int_handler(int irq, void *dev_id)
 			}
 			if (c && (tc2 & BIT(i))) {
 				spin_lock_irqsave(&c->vc.lock, flags);
-				if (p->ds_run != NULL)
+				if (p->ds_run)
 					vchan_cyclic_callback(&p->ds_run->vd);
 				spin_unlock_irqrestore(&c->vc.lock, flags);
 			}
@@ -312,7 +312,7 @@ static void k3_dma_tasklet(unsigned long arg)
 	for (pch = 0; pch < d->dma_channels; pch++) {
 		p = &d->phy[pch];
 
-		if (p->vchan == NULL && !list_empty(&d->chan_pending)) {
+		if (!p->vchan && !list_empty(&d->chan_pending)) {
 			c = list_first_entry(&d->chan_pending,
 				struct k3_dma_chan, node);
 			/* remove from d->chan_pending */
@@ -527,7 +527,7 @@ static struct dma_async_tx_descriptor *k3_dma_prep_slave_sg(
 	dma_addr_t addr, src = 0, dst = 0;
 	int num = sglen, i;
 
-	if (sgl == NULL)
+	if (!sgl)
 		return NULL;
 
 	c->cyclic = 0;
@@ -645,7 +645,7 @@ static int k3_dma_config(struct dma_chan *chan,
 	u32 maxburst = 0, val = 0;
 	enum dma_slave_buswidth width = DMA_SLAVE_BUSWIDTH_UNDEFINED;
 
-	if (cfg == NULL)
+	if (!cfg)
 		return -EINVAL;
 	c->dir = cfg->direction;
 	if (c->dir == DMA_DEV_TO_MEM) {
@@ -847,7 +847,7 @@ static int k3_dma_probe(struct platform_device *op)
 	/* init phy channel */
 	d->phy = devm_kcalloc(&op->dev, d->dma_channels, sizeof(*d->phy),
 			      GFP_KERNEL);
-	if (d->phy == NULL)
+	if (!d->phy)
 		return -ENOMEM;
 
 	for (i = 0; i < d->dma_channels; i++) {
@@ -877,7 +877,7 @@ static int k3_dma_probe(struct platform_device *op)
 	/* init virtual channel */
 	d->chans = devm_kcalloc(&op->dev, d->dma_requests, sizeof(*d->chans),
 				GFP_KERNEL);
-	if (d->chans == NULL)
+	if (!d->chans)
 		return -ENOMEM;
 
 	for (i = 0; i < d->dma_requests; i++) {
-- 
2.12.2

WARNING: multiple messages have this Message-ID (diff)
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: dmaengine@vger.kernel.org,
	Dan Williams <dan.j.williams@intel.com>,
	Vinod Koul <vinod.koul@intel.com>,
	Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org
Subject: [PATCH 2/2] dmaengine: k3dma: Adjust six checks for null pointers
Date: Sun, 23 Apr 2017 09:09:19 +0000	[thread overview]
Message-ID: <12cb50fb-63b7-8127-700d-1fe1c75c3961@users.sourceforge.net> (raw)
In-Reply-To: <f83beedc-28fd-c373-cca8-7261e42577a5@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 23 Apr 2017 10:47:04 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/dma/k3dma.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c
index 31a51ee1a910..da20565f7a8d 100644
--- a/drivers/dma/k3dma.c
+++ b/drivers/dma/k3dma.c
@@ -230,7 +230,7 @@ static irqreturn_t k3_dma_int_handler(int irq, void *dev_id)
 			}
 			if (c && (tc2 & BIT(i))) {
 				spin_lock_irqsave(&c->vc.lock, flags);
-				if (p->ds_run != NULL)
+				if (p->ds_run)
 					vchan_cyclic_callback(&p->ds_run->vd);
 				spin_unlock_irqrestore(&c->vc.lock, flags);
 			}
@@ -312,7 +312,7 @@ static void k3_dma_tasklet(unsigned long arg)
 	for (pch = 0; pch < d->dma_channels; pch++) {
 		p = &d->phy[pch];
 
-		if (p->vchan = NULL && !list_empty(&d->chan_pending)) {
+		if (!p->vchan && !list_empty(&d->chan_pending)) {
 			c = list_first_entry(&d->chan_pending,
 				struct k3_dma_chan, node);
 			/* remove from d->chan_pending */
@@ -527,7 +527,7 @@ static struct dma_async_tx_descriptor *k3_dma_prep_slave_sg(
 	dma_addr_t addr, src = 0, dst = 0;
 	int num = sglen, i;
 
-	if (sgl = NULL)
+	if (!sgl)
 		return NULL;
 
 	c->cyclic = 0;
@@ -645,7 +645,7 @@ static int k3_dma_config(struct dma_chan *chan,
 	u32 maxburst = 0, val = 0;
 	enum dma_slave_buswidth width = DMA_SLAVE_BUSWIDTH_UNDEFINED;
 
-	if (cfg = NULL)
+	if (!cfg)
 		return -EINVAL;
 	c->dir = cfg->direction;
 	if (c->dir = DMA_DEV_TO_MEM) {
@@ -847,7 +847,7 @@ static int k3_dma_probe(struct platform_device *op)
 	/* init phy channel */
 	d->phy = devm_kcalloc(&op->dev, d->dma_channels, sizeof(*d->phy),
 			      GFP_KERNEL);
-	if (d->phy = NULL)
+	if (!d->phy)
 		return -ENOMEM;
 
 	for (i = 0; i < d->dma_channels; i++) {
@@ -877,7 +877,7 @@ static int k3_dma_probe(struct platform_device *op)
 	/* init virtual channel */
 	d->chans = devm_kcalloc(&op->dev, d->dma_requests, sizeof(*d->chans),
 				GFP_KERNEL);
-	if (d->chans = NULL)
+	if (!d->chans)
 		return -ENOMEM;
 
 	for (i = 0; i < d->dma_requests; i++) {
-- 
2.12.2


  parent reply	other threads:[~2017-04-23  9:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-23  9:06 [PATCH 0/2] dmaengine: k3dma: Fine-tuning for five function implementations SF Markus Elfring
2017-04-23  9:06 ` SF Markus Elfring
2017-04-23  9:07 ` [PATCH 1/2] dmaengine: k3dma: Use devm_kcalloc() in k3_dma_probe() SF Markus Elfring
2017-04-23  9:07   ` SF Markus Elfring
2017-04-23  9:09 ` SF Markus Elfring [this message]
2017-04-23  9:09   ` [PATCH 2/2] dmaengine: k3dma: Adjust six checks for null pointers SF Markus Elfring

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=12cb50fb-63b7-8127-700d-1fe1c75c3961@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vinod.koul@intel.com \
    --cc=zhangfei.gao@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.