Re: [PATCH] dma: imx-dma: fix signedness bug

From: Dan Williams
Date: Tue Oct 19 2010 - 18:26:14 EST


On Sun, Oct 17, 2010 at 7:51 AM, Vasiliy Kulikov <segooon@xxxxxxxxx> 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@xxxxxxxxx>
> ---
>  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 linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/