public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Ken Gordon" <kengordon@magneticscrolls.com>
To: "David Woodhouse" <dwmw2@infradead.org>
Cc: linux-mtd@lists.infradead.org
Subject: Re: Getting a mtd_info with a valid map.
Date: Wed, 18 Jun 2003 12:27:08 +0100	[thread overview]
Message-ID: <004a01c3358c$8e522eb0$1207a8c0@kenlap> (raw)
In-Reply-To: 1055933659.2233.98.camel@passion.cambridge.redhat.com


>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@infradead.org>
To: "Ken Gordon" <kengordon@magneticscrolls.com>
Cc: <linux-mtd@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
>

  reply	other threads:[~2003-06-18 11:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-18 10:45 Getting a mtd_info with a valid map Ken Gordon
2003-06-18 10:54 ` David Woodhouse
2003-06-18 11:27   ` Ken Gordon [this message]
2003-06-18 11:32     ` Jörn Engel
2003-06-18 11:33     ` David Woodhouse
2003-06-18 12:37       ` Ken Gordon
2003-06-18 12:42         ` David Woodhouse

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='004a01c3358c$8e522eb0$1207a8c0@kenlap' \
    --to=kengordon@magneticscrolls.com \
    --cc=dwmw2@infradead.org \
    --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