Getting a mtd_info with a valid map.

Ken Gordon kengordon at magneticscrolls.com
Wed Jun 18 07:27:08 EDT 2003


>From cfi_cmdset_0001.c

static int cfi_intelext_read_user_prot_reg (struct mtd_info *mtd, loff_t
from, size_t len, size_t *r
etlen, u_char *buf)
{
    struct map_info *map = mtd->priv;
    struct cfi_private *cfi = map->fldrv_priv;        EXPODE HERE is map ==
NULL
    struct cfi_pri_intelext *extp=cfi->cmdset_priv;
    int base_offst,reg_sz;

    /* Check that we actually have some protection registers */
    if(!(extp->FeatureSupport&64)){
        printk(KERN_WARNING "%s: This flash device has no protection data to
read!\n",map->name);
        return 0;
    }

    base_offst=(1<<extp->FactProtRegSize);
    reg_sz=(1<<extp->UserProtRegSize);

    return cfi_intelext_read_prot_reg(mtd, from, len, retlen, buf,
base_offst, reg_sz);
}
----- Original Message ----- 
From: "David Woodhouse" <dwmw2 at infradead.org>
To: "Ken Gordon" <kengordon at magneticscrolls.com>
Cc: <linux-mtd at lists.infradead.org>
Sent: Wednesday, June 18, 2003 11:54 AM
Subject: Re: Getting a mtd_info with a valid map.


> On Wed, 2003-06-18 at 11:45, Ken Gordon wrote:
> > I'm trying to read the serial number from my Intel Strataflash (J3)
suing
> > mtd->read_user_prot_reg and mtd->read_fact_prot_reg. This code below
looks
> > to me like it should do the job but explodes because the mtd_info
returned
> > by get_mtd_device has a NULL priv field.
>
> I don't understand. When the 'map' is NULL you still call
> mtd->read_user_prot_reg() anyway... doesn't it work?
>
> What do you think that 'priv' is an abbreviation for, by the way? Under
> what circumstances do you think a programmer would name a variable like
> that? :)
>
> -- 
> dwmw2
>




More information about the linux-mtd mailing list