* [PATCH] dma: imx-dma: fix signedness bug
@ 2010-10-17 14:51 Vasiliy Kulikov
2010-10-18 8:02 ` Sascha Hauer
2010-10-19 22:26 ` Dan Williams
0 siblings, 2 replies; 5+ messages in thread
From: Vasiliy Kulikov @ 2010-10-17 14:51 UTC (permalink / raw)
To: kernel-janitors; +Cc: Dan Williams, Sascha Hauer, Linus Walleij, linux-kernel
mxdmac->channel was unsigned, so check (imxdmac->channel < 0) for
failed imx_dma_request_by_prio() made no sence. Explicitly check
signed values.
Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
drivers/dma/imx-dma.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 346be62..75d870f 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -335,7 +335,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
imxdmac->imxdma_channel = imx_dma_request_by_prio("dmaengine",
DMA_PRIO_MEDIUM);
- if (imxdmac->channel < 0)
+ if ((int)imxdmac->channel < 0)
goto err_init;
imx_dma_setup_handlers(imxdmac->imxdma_channel,
--
1.7.0.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] dma: imx-dma: fix signedness bug
2010-10-17 14:51 [PATCH] dma: imx-dma: fix signedness bug Vasiliy Kulikov
@ 2010-10-18 8:02 ` Sascha Hauer
2010-10-19 22:26 ` Dan Williams
1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2010-10-18 8:02 UTC (permalink / raw)
To: Vasiliy Kulikov
Cc: kernel-janitors, Dan Williams, Linus Walleij, linux-kernel
On Sun, Oct 17, 2010 at 06:51:50PM +0400, Vasiliy Kulikov wrote:
> mxdmac->channel was unsigned, so check (imxdmac->channel < 0) for
> failed imx_dma_request_by_prio() made no sence. Explicitly check
> signed values.
>
> Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> drivers/dma/imx-dma.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
> index 346be62..75d870f 100644
> --- a/drivers/dma/imx-dma.c
> +++ b/drivers/dma/imx-dma.c
> @@ -335,7 +335,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
>
> imxdmac->imxdma_channel = imx_dma_request_by_prio("dmaengine",
> DMA_PRIO_MEDIUM);
> - if (imxdmac->channel < 0)
> + if ((int)imxdmac->channel < 0)
> goto err_init;
>
> imx_dma_setup_handlers(imxdmac->imxdma_channel,
> --
> 1.7.0.4
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dma: imx-dma: fix signedness bug
2010-10-17 14:51 [PATCH] dma: imx-dma: fix signedness bug Vasiliy Kulikov
2010-10-18 8:02 ` Sascha Hauer
@ 2010-10-19 22:26 ` Dan Williams
2010-10-20 6:35 ` Sascha Hauer
2010-10-20 6:37 ` Sascha Hauer
1 sibling, 2 replies; 5+ messages in thread
From: Dan Williams @ 2010-10-19 22:26 UTC (permalink / raw)
To: Vasiliy Kulikov
Cc: kernel-janitors, Sascha Hauer, Linus Walleij, linux-kernel
On Sun, Oct 17, 2010 at 7:51 AM, Vasiliy Kulikov <segooon@gmail.com> wrote:
> mxdmac->channel was unsigned, so check (imxdmac->channel < 0) for
> failed imx_dma_request_by_prio() made no sence. Explicitly check
> signed values.
>
> Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> ---
> drivers/dma/imx-dma.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
> index 346be62..75d870f 100644
> --- a/drivers/dma/imx-dma.c
> +++ b/drivers/dma/imx-dma.c
> @@ -335,7 +335,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
>
> imxdmac->imxdma_channel = imx_dma_request_by_prio("dmaengine",
> DMA_PRIO_MEDIUM);
> - if (imxdmac->channel < 0)
> + if ((int)imxdmac->channel < 0)
> goto err_init;
Should this be:
if ((int)imxdmac->channel < 0) {
ret = -ENODEV;
goto err_init;
}
...because I get the following in my compilation tests.
drivers/dma/imx-dma.c: In function 'imxdma_probe':
drivers/dma/imx-dma.c:324: warning: 'ret' may be used uninitialized in
this function
--
Dan
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dma: imx-dma: fix signedness bug
2010-10-19 22:26 ` Dan Williams
@ 2010-10-20 6:35 ` Sascha Hauer
2010-10-20 6:37 ` Sascha Hauer
1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2010-10-20 6:35 UTC (permalink / raw)
To: Dan Williams
Cc: Vasiliy Kulikov, kernel-janitors, Linus Walleij, linux-kernel
On Tue, Oct 19, 2010 at 03:26:05PM -0700, Dan Williams wrote:
> On Sun, Oct 17, 2010 at 7:51 AM, Vasiliy Kulikov <segooon@gmail.com> wrote:
> > mxdmac->channel was unsigned, so check (imxdmac->channel < 0) for
> > failed imx_dma_request_by_prio() made no sence. Explicitly check
> > signed values.
> >
> > Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
> > ---
> > drivers/dma/imx-dma.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
> > index 346be62..75d870f 100644
> > --- a/drivers/dma/imx-dma.c
> > +++ b/drivers/dma/imx-dma.c
> > @@ -335,7 +335,7 @@ static int __init imxdma_probe(struct platform_device *pdev)
> >
> > imxdmac->imxdma_channel = imx_dma_request_by_prio("dmaengine",
> > DMA_PRIO_MEDIUM);
> > - if (imxdmac->channel < 0)
> > + if ((int)imxdmac->channel < 0)
> > goto err_init;
>
> Should this be:
>
> if ((int)imxdmac->channel < 0) {
> ret = -ENODEV;
> goto err_init;
> }
>
> ...because I get the following in my compilation tests.
Yes, ret is clearly used uninitialized. I wonder why my gcc-4.3.2 compiler
does not warn me about this :(
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dma: imx-dma: fix signedness bug
2010-10-19 22:26 ` Dan Williams
2010-10-20 6:35 ` Sascha Hauer
@ 2010-10-20 6:37 ` Sascha Hauer
1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2010-10-20 6:37 UTC (permalink / raw)
To: Dan Williams
Cc: Vasiliy Kulikov, kernel-janitors, Linus Walleij, linux-kernel
mxdmac->channel was unsigned, so check (imxdmac->channel < 0) for
failed imx_dma_request_by_prio() made no sence. Explicitly check
signed values.
Also, fix uninitialzed use of ret.
Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Here's an updated patch fixing both issues.
drivers/dma/imx-dma.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c
index 346be62..f629e49 100644
--- a/drivers/dma/imx-dma.c
+++ b/drivers/dma/imx-dma.c
@@ -335,8 +335,10 @@ static int __init imxdma_probe(struct platform_device *pdev)
imxdmac->imxdma_channel = imx_dma_request_by_prio("dmaengine",
DMA_PRIO_MEDIUM);
- if (imxdmac->channel < 0)
+ if ((int)imxdmac->channel < 0) {
+ ret = -ENODEV;
goto err_init;
+ }
imx_dma_setup_handlers(imxdmac->imxdma_channel,
imxdma_irq_handler, imxdma_err_handler, imxdmac);
--
1.7.2.3
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-10-20 6:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-17 14:51 [PATCH] dma: imx-dma: fix signedness bug Vasiliy Kulikov
2010-10-18 8:02 ` Sascha Hauer
2010-10-19 22:26 ` Dan Williams
2010-10-20 6:35 ` Sascha Hauer
2010-10-20 6:37 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox