mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhang Wei <zw@zh-kernel.org>
To: Li Yang <leoli@freescale.com>, dan.j.williams@intel.com
Cc: linux-kernel@vger.kernel.org
Subject: RE: [PATCH] fsldma: fix incorrect exit path for initialization
Date: Tue, 20 May 2008 22:35:37 -0800	[thread overview]
Message-ID: <8E0F58A2820.00000313zw@zh-kernel.org> (raw)
In-Reply-To: <1211351459-32355-1-git-send-email-leoli@freescale.com>

> -----Original Message-----
> From: leoli@freescale.com
> 
> Signed-off-by: Li Yang <leoli@freescale.com>
> Cc: Zhang Wei <zw@zh-kernel.org>

Acked-by: Zhang Wei <zw@zh-kernel.org>

> ---
>  drivers/dma/fsldma.c |   31 ++++++++++++++++---------------
>  1 files changed, 16 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
> index 054eabf..724f6fd 100644
> --- a/drivers/dma/fsldma.c
> +++ b/drivers/dma/fsldma.c
> @@ -809,8 +809,7 @@ static int fsl_dma_self_test(struct fsl_dma_chan
> *fsl_chan)
>  	if (!src) {
>  		dev_err(fsl_chan->dev,
>  				"selftest: Cannot alloc memory for test!\n");
> -		err = -ENOMEM;
> -		goto out;
> +		return -ENOMEM;
>  	}
> 
>  	dest = src + test_size;
> @@ -842,7 +841,7 @@ static int fsl_dma_self_test(struct fsl_dma_chan
> *fsl_chan)
>  	if (fsl_dma_is_complete(chan, cookie, NULL, NULL) != DMA_SUCCESS) {
>  		dev_err(fsl_chan->dev, "selftest: Time out!\n");
>  		err = -ENODEV;
> -		goto out;
> +		goto free_resources;
>  	}
> 
>  	/* Test free and re-alloc channel resources */
> @@ -927,8 +926,7 @@ static int __devinit of_fsl_dma_chan_probe(struct
> of_device *dev,
>  	if (!new_fsl_chan) {
>  		dev_err(&dev->dev, "No free memory for allocating "
>  				"dma channels!\n");
> -		err = -ENOMEM;
> -		goto err;
> +		return -ENOMEM;
>  	}
> 
>  	/* get dma channel register base */
> @@ -936,7 +934,7 @@ static int __devinit of_fsl_dma_chan_probe(struct
> of_device *dev,
>  	if (err) {
>  		dev_err(&dev->dev, "Can't get %s property 'reg'\n",
>  				dev->node->full_name);
> -		goto err;
> +		goto err_no_reg;
>  	}
> 
>  	new_fsl_chan->feature = *(u32 *)match->data;
> @@ -958,7 +956,7 @@ static int __devinit of_fsl_dma_chan_probe(struct
> of_device *dev,
>  		dev_err(&dev->dev, "There is no %d channel!\n",
>  				new_fsl_chan->id);
>  		err = -EINVAL;
> -		goto err;
> +		goto err_no_chan;
>  	}
>  	fdev->chan[new_fsl_chan->id] = new_fsl_chan;
>  	tasklet_init(&new_fsl_chan->tasklet, dma_do_tasklet,
> @@ -997,23 +995,26 @@ static int __devinit of_fsl_dma_chan_probe(struct
> of_device *dev,
>  		if (err) {
>  			dev_err(&dev->dev, "DMA channel %s request_irq error "
>  				"with return %d\n", dev->node->full_name, err);
> -			goto err;
> +			goto err_no_irq;
>  		}
>  	}
> 
>  	err = fsl_dma_self_test(new_fsl_chan);
>  	if (err)
> -		goto err;
> +		goto err_self_test;
> 
>  	dev_info(&dev->dev, "#%d (%s), irq %d\n", new_fsl_chan->id,
>  				match->compatible, new_fsl_chan->irq);
> 
>  	return 0;
> -err:
> -	dma_halt(new_fsl_chan);
> -	iounmap(new_fsl_chan->reg_base);
> +
> +err_self_test:
>  	free_irq(new_fsl_chan->irq, new_fsl_chan);
> +err_no_irq:
>  	list_del(&new_fsl_chan->common.device_node);
> +err_no_chan:
> +	iounmap(new_fsl_chan->reg_base);
> +err_no_reg:
>  	kfree(new_fsl_chan);
>  	return err;
>  }
> @@ -1054,8 +1055,7 @@ static int __devinit of_fsl_dma_probe(struct
> of_device *dev,
>  	fdev = kzalloc(sizeof(struct fsl_dma_device), GFP_KERNEL);
>  	if (!fdev) {
>  		dev_err(&dev->dev, "No enough memory for 'priv'\n");
> -		err = -ENOMEM;
> -		goto err;
> +		return -ENOMEM;
>  	}
>  	fdev->dev = &dev->dev;
>  	INIT_LIST_HEAD(&fdev->common.channels);
> @@ -1065,7 +1065,7 @@ static int __devinit of_fsl_dma_probe(struct
> of_device *dev,
>  	if (err) {
>  		dev_err(&dev->dev, "Can't get %s property 'reg'\n",
>  				dev->node->full_name);
> -		goto err;
> +		goto err_no_reg;
>  	}
> 
>  	dev_info(&dev->dev, "Probe the Freescale DMA driver for %s "
> @@ -1103,6 +1103,7 @@ static int __devinit of_fsl_dma_probe(struct
> of_device *dev,
> 
>  err:
>  	iounmap(fdev->reg_base);
> +err_no_reg:
>  	kfree(fdev);
>  	return err;
>  }
> --
> 1.5.5.1.248.g4b17

____________________________________________________________
FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks & orcas on your desktop!
Check it out at http://www.inbox.com/marineaquarium

      reply	other threads:[~2008-05-21  6:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-21  6:30 Li Yang
2008-05-21  6:35 ` Zhang Wei [this message]

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=8E0F58A2820.00000313zw@zh-kernel.org \
    --to=zw@zh-kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=leoli@freescale.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®