public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: roel kluin <roel.kluin@gmail.com>
To: mchehab@infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH] V4L/DVB: pxa-camera: Unsigned dma_chans[] cannot be negative
Date: Wed, 10 Sep 2008 18:12:26 +0200	[thread overview]
Message-ID: <48C7F1EA.6070008@gmail.com> (raw)

Unsigned dma_chans[] cannot be negative

Note that also the third time dma_chans[0] < 0 was tested instead of dma_chans[2]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/media/video/pxa_camera.c b/drivers/media/video/pxa_camera.c
index ead87dd..950a2d4 100644
--- a/drivers/media/video/pxa_camera.c
+++ b/drivers/media/video/pxa_camera.c
@@ -1078,7 +1078,7 @@ static int pxa_camera_probe(struct platform_device *pdev)
 	struct pxa_camera_dev *pcdev;
 	struct resource *res;
 	void __iomem *base;
-	int irq;
+	int irq, retval;
 	int err = 0;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -1144,31 +1144,34 @@ static int pxa_camera_probe(struct platform_device *pdev)
 	pcdev->dev = &pdev->dev;
 
 	/* request dma */
-	pcdev->dma_chans[0] = pxa_request_dma("CI_Y", DMA_PRIO_HIGH,
+	retval = pxa_request_dma("CI_Y", DMA_PRIO_HIGH,
 					      pxa_camera_dma_irq_y, pcdev);
-	if (pcdev->dma_chans[0] < 0) {
+	if (retval < 0) {
 		dev_err(pcdev->dev, "Can't request DMA for Y\n");
 		err = -ENOMEM;
 		goto exit_iounmap;
 	}
+	pcdev->dma_chans[0] = retval;
 	dev_dbg(pcdev->dev, "got DMA channel %d\n", pcdev->dma_chans[0]);
 
-	pcdev->dma_chans[1] = pxa_request_dma("CI_U", DMA_PRIO_HIGH,
+	retval = pxa_request_dma("CI_U", DMA_PRIO_HIGH,
 					      pxa_camera_dma_irq_u, pcdev);
-	if (pcdev->dma_chans[1] < 0) {
+	if (retval < 0) {
 		dev_err(pcdev->dev, "Can't request DMA for U\n");
 		err = -ENOMEM;
 		goto exit_free_dma_y;
 	}
+	pcdev->dma_chans[1] = retval;
 	dev_dbg(pcdev->dev, "got DMA channel (U) %d\n", pcdev->dma_chans[1]);
 
-	pcdev->dma_chans[2] = pxa_request_dma("CI_V", DMA_PRIO_HIGH,
+	retval = pxa_request_dma("CI_V", DMA_PRIO_HIGH,
 					      pxa_camera_dma_irq_v, pcdev);
-	if (pcdev->dma_chans[0] < 0) {
+	if (retval < 0) {
 		dev_err(pcdev->dev, "Can't request DMA for V\n");
 		err = -ENOMEM;
 		goto exit_free_dma_u;
 	}
+	pcdev->dma_chans[2] = retval;
 	dev_dbg(pcdev->dev, "got DMA channel (V) %d\n", pcdev->dma_chans[2]);
 
 	DRCMR68 = pcdev->dma_chans[0] | DRCMR_MAPVLD;

             reply	other threads:[~2008-09-10 16:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-10 16:12 roel kluin [this message]
2008-09-11 11:30 ` [PATCH] V4L/DVB: pxa-camera: Unsigned dma_chans[] cannot be negative Guennadi Liakhovetski

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=48C7F1EA.6070008@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox