public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Andrew Victor <andrew@sanpeople.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] AT91RM9200 NAND support
Date: Tue, 20 Jun 2006 09:08:55 +0200	[thread overview]
Message-ID: <1150787336.6780.102.camel@localhost.localdomain> (raw)
In-Reply-To: <1150786454.15581.289.camel@fuzzie.sanpeople.com>

On Tue, 2006-06-20 at 08:54 +0200, Andrew Victor wrote:
> This is a NAND drivers for the Atmel AT91RM9200 SoC.
> 
> (No changes since it was committed to the MTD CVS on 21/02/2006)

As I pointed out in my previous mail, the driver needs to be updated to
work with the latest changes in the nand driver.

> +/*
> + * Hardware specific access to control-lines
> + */
> +static void at91_nand_hwcontrol(struct mtd_info *mtd, int cmd)

This function needs to be adjusted.

> +#ifdef CONFIG_MTD_PARTITIONS
> +	if (host->board->partition_info)
> +		partitions = host->board->partition_info(mtd->size, &num_partitions);
> +
> +	if ((!partitions) || (num_partitions == 0)) {
> +		printk(KERN_ERR "at91_nand: No parititions defined, or unsupported device.\n");
> +		res = ENXIO;
> +		goto out;
> +	}
> +
> +	res = add_mtd_partitions(mtd, partitions, num_partitions);
> +#else
> +	res = add_mtd_device(mtd);
> +#endif
> +
> +out:

If you error out after a sucessful nand_scan() - i.e. chip was detected
- you have to call nand_release(). nand_scan() allocates memory which
gets freed inside nand_release()

> +	if (res) {
> +		at91_nand_disable(host);
> +		platform_set_drvdata(pdev, NULL);
> +
> +		iounmap(host->io_base);
> +		kfree(host);
> +	}
> +
> +	return res;
> +}
> +
> +/*
> + * Remove a NAND device.
> + */
> +static int __devexit at91_nand_remove(struct platform_device *pdev)
> +{
> +	struct at91_nand_host *host = platform_get_drvdata(pdev);
> +	struct mtd_info *mtd = &host->mtd;
> +
> +	del_mtd_partitions(mtd);
> +	del_mtd_device(mtd);

nand_release() does this and you have to call it - otherwise you get a
memory leak !

	tglx

  reply	other threads:[~2006-06-20  7:08 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-20  6:54 [PATCH] AT91RM9200 NAND support Andrew Victor
2006-06-20  7:08 ` Thomas Gleixner [this message]
2006-06-20  7:17   ` Andrew Victor
2006-06-20  7:43     ` Savin Zlobec
2006-06-20  8:00       ` Thomas Gleixner
2006-06-20  8:08         ` Thomas Gleixner
2006-06-20  9:07         ` Savin Zlobec
2006-06-20  9:18           ` Thomas Gleixner
2006-06-20 10:49             ` Savin Zlobec
2006-06-20 11:12               ` Thomas Gleixner
2006-06-20 11:42                 ` Savin Zlobec
2006-06-20 11:55                   ` Thomas Gleixner
2006-06-20 12:28                     ` Savin Zlobec
2006-06-20 12:44                       ` Thomas Gleixner
2006-06-20 12:52                         ` Thomas Gleixner
2006-06-20 13:17                           ` Savin Zlobec
2006-06-20 13:01                         ` Savin Zlobec
2006-06-20 13:21                           ` Thomas Gleixner
2006-06-20 13:48                             ` Savin Zlobec
2006-06-20 13:57                               ` Thomas Gleixner
2006-06-20 14:24                                 ` Savin Zlobec
2006-06-20 14:24                                   ` Thomas Gleixner
2006-06-20 14:29                                   ` Thomas Gleixner
2006-06-20 15:53                                     ` Savin Zlobec
2006-06-20 15:53                                       ` Thomas Gleixner
2006-06-20 16:03                                         ` Savin Zlobec
2006-06-20  9:07   ` David Woodhouse
2006-06-20  9:14     ` Thomas Gleixner

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=1150787336.6780.102.camel@localhost.localdomain \
    --to=tglx@linutronix.de \
    --cc=andrew@sanpeople.com \
    --cc=linux-mtd@lists.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