[PATCH]: 2.6.24-rc5: mtd: PNC-2000 oops

Josh Boyer jwboyer at gmail.com
Sun Dec 30 09:05:52 EST 2007


On Sun, 30 Dec 2007 14:15:13 +0100
devzero at web.de wrote:

> while doing some systematical driver load/unload testing i have also come across this one.
> 
> searched lkml and found/tried this patch - seems to work fine, at least driver now behaves as expected:
> insmod: error inserting 'pnc2000.ko': -1 No such device or address
> 
> if it really _works_ is another story, but how can we know ? have searched the net a while for this hardware, but didn`t find _any_ reference that this hardware either exists or existed at all, so it looks that this hardware is very ancient or being used by japanese secret service, only !? :)

[snip] 
 
> @@ -64,16 +63,29 @@ static struct mtd_info *mymtd;
>  
>  static int __init init_pnc2000(void)
>  {
> +	int err;
> +
>  	printk(KERN_NOTICE "Photron PNC-2000 flash mapping: %x at %x\n", WINDOW_SIZE, \
> WINDOW_ADDR);  
> +	pnc_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
> +	if (!pnc_map.virt) {
> +		printk("init_pnc2000(): failed to ioremap\n");
> +		return -EIO;
> +	}
> +
>  	simple_map_init(&pnc_map);
>  
>  	mymtd = do_map_probe("cfi_probe", &pnc_map);
>  	if (mymtd) {
>  		mymtd->owner = THIS_MODULE;
> -		return add_mtd_partitions(mymtd, pnc_partitions, 3);
> +		err = add_mtd_partitions(mymtd, pnc_partitions, 3);
> +		if (err) {
> +			printk("init_pnc2000(): add_mtd_partitions failed\n");
> +			iounmap(pnc_map.virt);
> +		}
>  	}
>  
> +	iounmap(pnc_map.virt);
>  	return -ENXIO;

Sorry, but no.  This bit here is bogus.  It will now iounmap and return
an error even if nothing went wrong.

josh



More information about the linux-mtd mailing list