Commit 7140ae4b authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: NULL noise is mtd

0->NULL conversions in mtd
parent b706f5fa
...@@ -718,7 +718,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map) ...@@ -718,7 +718,7 @@ static struct mtd_info *amd_flash_probe(struct map_info *map)
"memory for MTD erase region info\n", map->name); "memory for MTD erase region info\n", map->name);
kfree(mtd); kfree(mtd);
map->fldrv_priv = NULL; map->fldrv_priv = NULL;
return 0; return NULL;
} }
reg_idx = 0; reg_idx = 0;
......
...@@ -1424,7 +1424,7 @@ int cfi_intelext_erase_varsize(struct mtd_info *mtd, struct erase_info *instr) ...@@ -1424,7 +1424,7 @@ int cfi_intelext_erase_varsize(struct mtd_info *mtd, struct erase_info *instr)
ofs = instr->addr; ofs = instr->addr;
len = instr->len; len = instr->len;
ret = cfi_intelext_varsize_frob(mtd, do_erase_oneblock, ofs, len, 0); ret = cfi_intelext_varsize_frob(mtd, do_erase_oneblock, ofs, len, NULL);
if (ret) if (ret)
return ret; return ret;
......
...@@ -128,7 +128,7 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -128,7 +128,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
{ {
printk("mtd: Increase MAX_JEDEC_CHIPS, too many banks.\n"); printk("mtd: Increase MAX_JEDEC_CHIPS, too many banks.\n");
kfree(MTD); kfree(MTD);
return 0; return NULL;
} }
for (Base = 0; Base < map->size; Base += my_bank_size) for (Base = 0; Base < map->size; Base += my_bank_size)
...@@ -141,7 +141,7 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -141,7 +141,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
if (jedec_probe8(map,Base,priv) == 0) { if (jedec_probe8(map,Base,priv) == 0) {
printk("did recognize jedec chip\n"); printk("did recognize jedec chip\n");
kfree(MTD); kfree(MTD);
return 0; return NULL;
} }
} }
if (map->buswidth == 2) if (map->buswidth == 2)
...@@ -167,7 +167,7 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -167,7 +167,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
{ {
printk("mtd: Failed. Device has incompatible mixed sector sizes\n"); printk("mtd: Failed. Device has incompatible mixed sector sizes\n");
kfree(MTD); kfree(MTD);
return 0; return NULL;
} }
} }
...@@ -193,7 +193,7 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -193,7 +193,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
{ {
printk("mtd: Internal Error, JEDEC not set\n"); printk("mtd: Internal Error, JEDEC not set\n");
kfree(MTD); kfree(MTD);
return 0; return NULL;
} }
if (Uniq != 0) if (Uniq != 0)
...@@ -221,7 +221,7 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -221,7 +221,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
if (!priv->size) { if (!priv->size) {
printk("priv->size is zero\n"); printk("priv->size is zero\n");
kfree(MTD); kfree(MTD);
return 0; return NULL;
} }
if (priv->size/my_bank_size) { if (priv->size/my_bank_size) {
if (priv->size/my_bank_size == 1) { if (priv->size/my_bank_size == 1) {
...@@ -240,7 +240,7 @@ static struct mtd_info *jedec_probe(struct map_info *map) ...@@ -240,7 +240,7 @@ static struct mtd_info *jedec_probe(struct map_info *map)
{ {
printk("mtd: Failed. Cannot handle unsymmetric banking\n"); printk("mtd: Failed. Cannot handle unsymmetric banking\n");
kfree(MTD); kfree(MTD);
return 0; return NULL;
} }
} }
} }
...@@ -385,7 +385,7 @@ static const struct JEDECTable *jedec_idtoinf(__u8 mfr,__u8 id) ...@@ -385,7 +385,7 @@ static const struct JEDECTable *jedec_idtoinf(__u8 mfr,__u8 id)
for (I = 0; JEDEC_table[I].jedec != 0; I++) for (I = 0; JEDEC_table[I].jedec != 0; I++)
if (JEDEC_table[I].jedec == Id) if (JEDEC_table[I].jedec == Id)
return JEDEC_table + I; return JEDEC_table + I;
return 0; return NULL;
} }
// Look for flash using an 8 bit bus interface // Look for flash using an 8 bit bus interface
......
...@@ -1480,7 +1480,7 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index) ...@@ -1480,7 +1480,7 @@ static int cfi_jedec_setup(struct cfi_private *p_cfi, int index)
for (i=0; i<num_erase_regions; i++){ for (i=0; i<num_erase_regions; i++){
p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i]; p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i];
} }
p_cfi->cmdset_priv = 0; p_cfi->cmdset_priv = NULL;
/* This may be redundant for some cases, but it doesn't hurt */ /* This may be redundant for some cases, but it doesn't hurt */
p_cfi->mfr = jedec_table[index].mfr_id; p_cfi->mfr = jedec_table[index].mfr_id;
......
...@@ -94,7 +94,7 @@ static struct mtd_partition * newpart(char *s, ...@@ -94,7 +94,7 @@ static struct mtd_partition * newpart(char *s,
if (size < PAGE_SIZE) if (size < PAGE_SIZE)
{ {
printk(KERN_ERR ERRP "partition size too small (%lx)\n", size); printk(KERN_ERR ERRP "partition size too small (%lx)\n", size);
return 0; return NULL;
} }
} }
...@@ -121,7 +121,7 @@ static struct mtd_partition * newpart(char *s, ...@@ -121,7 +121,7 @@ static struct mtd_partition * newpart(char *s,
if ((p = strchr(name, delim)) == 0) if ((p = strchr(name, delim)) == 0)
{ {
printk(KERN_ERR ERRP "no closing %c found in partition name\n", delim); printk(KERN_ERR ERRP "no closing %c found in partition name\n", delim);
return 0; return NULL;
} }
name_len = p - name; name_len = p - name;
s = p + 1; s = p + 1;
...@@ -148,12 +148,12 @@ static struct mtd_partition * newpart(char *s, ...@@ -148,12 +148,12 @@ static struct mtd_partition * newpart(char *s,
if (size == SIZE_REMAINING) if (size == SIZE_REMAINING)
{ {
printk(KERN_ERR ERRP "no partitions allowed after a fill-up partition\n"); printk(KERN_ERR ERRP "no partitions allowed after a fill-up partition\n");
return 0; return NULL;
} }
/* more partitions follow, parse them */ /* more partitions follow, parse them */
if ((parts = newpart(s + 1, &s, num_parts, if ((parts = newpart(s + 1, &s, num_parts,
this_part + 1, &extra_mem, extra_mem_size)) == 0) this_part + 1, &extra_mem, extra_mem_size)) == 0)
return 0; return NULL;
} }
else else
{ /* this is the last partition: allocate space for all */ { /* this is the last partition: allocate space for all */
...@@ -166,7 +166,7 @@ static struct mtd_partition * newpart(char *s, ...@@ -166,7 +166,7 @@ static struct mtd_partition * newpart(char *s,
if (!parts) if (!parts)
{ {
printk(KERN_ERR ERRP "out of memory\n"); printk(KERN_ERR ERRP "out of memory\n");
return 0; return NULL;
} }
memset(parts, 0, alloc_size); memset(parts, 0, alloc_size);
extra_mem = (unsigned char *)(parts + *num_parts); extra_mem = (unsigned char *)(parts + *num_parts);
......
...@@ -599,7 +599,7 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -599,7 +599,7 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
size_t * retlen, u_char * buf) size_t * retlen, u_char * buf)
{ {
/* Just a special case of doc_read_ecc */ /* Just a special case of doc_read_ecc */
return doc_read_ecc(mtd, from, len, retlen, buf, NULL, 0); return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL);
} }
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
...@@ -748,7 +748,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -748,7 +748,7 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t * retlen, const u_char * buf) size_t * retlen, const u_char * buf)
{ {
char eccbuf[6]; char eccbuf[6];
return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, 0); return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL);
} }
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
......
...@@ -406,7 +406,7 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len, ...@@ -406,7 +406,7 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len,
size_t *retlen, u_char *buf) size_t *retlen, u_char *buf)
{ {
/* Just a special case of doc_read_ecc */ /* Just a special case of doc_read_ecc */
return doc_read_ecc(mtd, from, len, retlen, buf, NULL, 0); return doc_read_ecc(mtd, from, len, retlen, buf, NULL, NULL);
} }
static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
...@@ -533,7 +533,7 @@ static int doc_write (struct mtd_info *mtd, loff_t to, size_t len, ...@@ -533,7 +533,7 @@ static int doc_write (struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf) size_t *retlen, const u_char *buf)
{ {
char eccbuf[6]; char eccbuf[6];
return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, 0); return doc_write_ecc(mtd, to, len, retlen, buf, eccbuf, NULL);
} }
static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len, static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
......
...@@ -32,7 +32,7 @@ static struct amd76xrom_map_info amd76xrom_map = { ...@@ -32,7 +32,7 @@ static struct amd76xrom_map_info amd76xrom_map = {
.size = 0, .size = 0,
.buswidth = 1, .buswidth = 1,
}, },
.mtd = 0, .mtd = NULL,
.window_addr = 0, .window_addr = 0,
}; };
...@@ -53,7 +53,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, ...@@ -53,7 +53,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
static const u32 rom_probe_sizes[] = { static const u32 rom_probe_sizes[] = {
5*1024*1024, 4*1024*1024, 2*1024*1024, 1024*1024, 512*1024, 5*1024*1024, 4*1024*1024, 2*1024*1024, 1024*1024, 512*1024,
256*1024, 128*1024, 64*1024, 0}; 256*1024, 128*1024, 64*1024, 0};
static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", 0 }; static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
u8 byte; u8 byte;
struct amd76xrom_map_info *info = &amd76xrom_map; struct amd76xrom_map_info *info = &amd76xrom_map;
struct rom_window *window; struct rom_window *window;
...@@ -96,7 +96,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev, ...@@ -96,7 +96,7 @@ static int __devinit amd76xrom_init_one (struct pci_dev *pdev,
printk(KERN_ERR "Failed to ioremap\n"); printk(KERN_ERR "Failed to ioremap\n");
goto err_out_free_mmio_region; goto err_out_free_mmio_region;
} }
info->mtd = 0; info->mtd = NULL;
for(i = 0; (rom_size = rom_probe_sizes[i]); i++) { for(i = 0; (rom_size = rom_probe_sizes[i]); i++) {
char **chip_type; char **chip_type;
if (rom_size > window->size) { if (rom_size > window->size) {
...@@ -145,7 +145,7 @@ static void __devexit amd76xrom_remove_one (struct pci_dev *pdev) ...@@ -145,7 +145,7 @@ static void __devexit amd76xrom_remove_one (struct pci_dev *pdev)
del_mtd_device(info->mtd); del_mtd_device(info->mtd);
map_destroy(info->mtd); map_destroy(info->mtd);
info->mtd = 0; info->mtd = NULL;
info->map.virt = 0; info->map.virt = 0;
iounmap((void *)(info->window_addr)); iounmap((void *)(info->window_addr));
...@@ -184,9 +184,9 @@ int __init init_amd76xrom(void) ...@@ -184,9 +184,9 @@ int __init init_amd76xrom(void)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
struct pci_device_id *id; struct pci_device_id *id;
pdev = 0; pdev = NULL;
for(id = amd76xrom_pci_tbl; id->vendor; id++) { for(id = amd76xrom_pci_tbl; id->vendor; id++) {
pdev = pci_find_device(id->vendor, id->device, 0); pdev = pci_find_device(id->vendor, id->device, NULL);
if (pdev) { if (pdev) {
break; break;
} }
......
...@@ -109,7 +109,7 @@ static struct ich2rom_map_info ich2rom_map = { ...@@ -109,7 +109,7 @@ static struct ich2rom_map_info ich2rom_map = {
* needs to use a different method. * needs to use a different method.
*/ */
}, },
.mtd = 0, .mtd = NULL,
.window_addr = 0, .window_addr = 0,
}; };
...@@ -205,7 +205,7 @@ static int __devinit ich2rom_init_one (struct pci_dev *pdev, ...@@ -205,7 +205,7 @@ static int __devinit ich2rom_init_one (struct pci_dev *pdev,
/* FIXME select the firmware hub and enable a window to it. */ /* FIXME select the firmware hub and enable a window to it. */
info->mtd = 0; info->mtd = NULL;
info->map.map_priv_1 = info->window_addr; info->map.map_priv_1 = info->window_addr;
map_size = ICH2_FWH_REGION_SIZE; map_size = ICH2_FWH_REGION_SIZE;
...@@ -245,7 +245,7 @@ static void __devexit ich2rom_remove_one (struct pci_dev *pdev) ...@@ -245,7 +245,7 @@ static void __devexit ich2rom_remove_one (struct pci_dev *pdev)
del_mtd_device(info->mtd); del_mtd_device(info->mtd);
map_destroy(info->mtd); map_destroy(info->mtd);
info->mtd = 0; info->mtd = NULL;
info->map.map_priv_1 = 0; info->map.map_priv_1 = 0;
iounmap((void *)(info->window_addr)); iounmap((void *)(info->window_addr));
...@@ -286,9 +286,9 @@ int __init init_ich2rom(void) ...@@ -286,9 +286,9 @@ int __init init_ich2rom(void)
{ {
struct pci_dev *pdev; struct pci_dev *pdev;
struct pci_device_id *id; struct pci_device_id *id;
pdev = 0; pdev = NULL;
for(id = ich2rom_pci_tbl; id->vendor; id++) { for(id = ich2rom_pci_tbl; id->vendor; id++) {
pdev = pci_find_device(id->vendor, id->device, 0); pdev = pci_find_device(id->vendor, id->device, NULL);
if (pdev) { if (pdev) {
break; break;
} }
......
...@@ -66,7 +66,7 @@ const char *part_probes[] = {"cmdlinepart", "RedBoot", NULL}; ...@@ -66,7 +66,7 @@ const char *part_probes[] = {"cmdlinepart", "RedBoot", NULL};
int __init init_physmap(void) int __init init_physmap(void)
{ {
static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", 0 }; static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", NULL };
const char **type; const char **type;
printk(KERN_NOTICE "physmap flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR); printk(KERN_NOTICE "physmap flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
...@@ -79,7 +79,7 @@ int __init init_physmap(void) ...@@ -79,7 +79,7 @@ int __init init_physmap(void)
simple_map_init(&physmap_map); simple_map_init(&physmap_map);
mymtd = 0; mymtd = NULL;
type = rom_probe_types; type = rom_probe_types;
for(; !mymtd && *type; type++) { for(; !mymtd && *type; type++) {
mymtd = do_map_probe(*type, &physmap_map); mymtd = do_map_probe(*type, &physmap_map);
......
...@@ -409,7 +409,7 @@ int __init init_mtd(void) ...@@ -409,7 +409,7 @@ int __init init_mtd(void)
{ {
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
if ((proc_mtd = create_proc_entry( "mtd", 0, 0 ))) if ((proc_mtd = create_proc_entry( "mtd", 0, NULL )))
proc_mtd->read_proc = mtd_read_proc; proc_mtd->read_proc = mtd_read_proc;
#else #else
proc_register_dynamic(&proc_root,&mtd_proc_entry); proc_register_dynamic(&proc_root,&mtd_proc_entry);
...@@ -438,7 +438,7 @@ static void __exit cleanup_mtd(void) ...@@ -438,7 +438,7 @@ static void __exit cleanup_mtd(void)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
if (proc_mtd) if (proc_mtd)
remove_proc_entry( "mtd", 0); remove_proc_entry( "mtd", NULL);
#else #else
proc_unregister(&proc_root,mtd_proc_entry.low_ino); proc_unregister(&proc_root,mtd_proc_entry.low_ino);
#endif #endif
......
...@@ -966,7 +966,7 @@ static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t * ...@@ -966,7 +966,7 @@ static int nand_write_oob (struct mtd_info *mtd, loff_t to, size_t len, size_t *
static int nand_writev (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, static int nand_writev (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count,
loff_t to, size_t * retlen) loff_t to, size_t * retlen)
{ {
return (nand_writev_ecc (mtd, vecs, count, to, retlen, NULL, 0)); return (nand_writev_ecc (mtd, vecs, count, to, retlen, NULL, NULL));
} }
static int nand_writev_ecc (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, static int nand_writev_ecc (struct mtd_info *mtd, const struct kvec *vecs, unsigned long count,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment