2018-03-20 15:34:16

by Arushi Singhal

[permalink] [raw]
Subject: [PATCH v2 1/2] mtd: maps: Remove print after allocation failure

The prints after [k|v][m|z|c]alloc() functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <[email protected]>
---
changes in v2
* Prefered
if (!map) {
map = kmalloc();
if (!map)
err;
}

than

if (!map)
map = kmalloc();
if (!map)
err

drivers/mtd/maps/amd76xrom.c | 6 ++----
drivers/mtd/maps/ck804xrom.c | 8 +++-----
drivers/mtd/maps/esb2rom.c | 7 +++----
drivers/mtd/maps/ichxrom.c | 6 ++----
drivers/mtd/maps/sun_uflash.c | 4 +---
drivers/mtd/maps/vmu-flash.c | 3 ---
6 files changed, 11 insertions(+), 23 deletions(-)

diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index 26de0a1..406a8d3 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -188,10 +188,8 @@ static int amd76xrom_init_one(struct pci_dev *pdev,

if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
- }
- if (!map) {
- printk(KERN_ERR MOD_NAME ": kmalloc failed");
- goto out;
+ if (!map)
+ goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(&map->list);
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 584962e..7377623 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -216,12 +216,10 @@ static int __init ck804xrom_init_one(struct pci_dev *pdev,
unsigned long offset;
int i;

- if (!map)
- map = kmalloc(sizeof(*map), GFP_KERNEL);
-
if (!map) {
- printk(KERN_ERR MOD_NAME ": kmalloc failed");
- goto out;
+ map = kmalloc(sizeof(*map), GFP_KERNEL);
+ if (!map)
+ goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(&map->list);
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index da9f6d7..2c63ecd 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -276,11 +276,10 @@ static int __init esb2rom_init_one(struct pci_dev *pdev,
unsigned long offset;
int i;

- if (!map)
- map = kmalloc(sizeof(*map), GFP_KERNEL);
if (!map) {
- printk(KERN_ERR MOD_NAME ": kmalloc failed");
- goto out;
+ map = kmalloc(sizeof(*map), GFP_KERNEL);
+ if (!map)
+ goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(&map->list);
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c
index 1888c5b..cacef9d 100644
--- a/drivers/mtd/maps/ichxrom.c
+++ b/drivers/mtd/maps/ichxrom.c
@@ -212,10 +212,8 @@ static int __init ichxrom_init_one(struct pci_dev *pdev,

if (!map) {
map = kmalloc(sizeof(*map), GFP_KERNEL);
- }
- if (!map) {
- printk(KERN_ERR MOD_NAME ": kmalloc failed");
- goto out;
+ if (!map)
+ goto out;
}
memset(map, 0, sizeof(*map));
INIT_LIST_HEAD(&map->list);
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index 1e73bba..80a253c 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -62,10 +62,8 @@ int uflash_devinit(struct platform_device *op, struct device_node *dp)
}

up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
- if (!up) {
- printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
+ if (!up)
return -ENOMEM;
- }

/* copy defaults and tweak parameters */
memcpy(&up->map, &uflash_map_templ, sizeof(uflash_map_templ));
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 6b223cf..a76a5ff 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -130,9 +130,6 @@ static int maple_vmu_read_block(unsigned int num, unsigned char *buf,
if (!pcache->buffer) {
pcache->buffer = kmalloc(card->blocklen, GFP_KERNEL);
if (!pcache->buffer) {
- dev_err(&mdev->dev, "VMU at (%d, %d) - read fails due"
- " to lack of memory\n", mdev->port,
- mdev->unit);
error = -ENOMEM;
goto outB;
}
--
2.7.4



2018-03-20 15:34:47

by Arushi Singhal

[permalink] [raw]
Subject: [PATCH v2 2/2] mtd: nand: Remove print after allocation failure

The prints after [k|v][m|z|c]alloc() etc. functions are not needed, because
in case of failure, allocator will print their internal error prints
anyway.

Signed-off-by: Arushi Singhal <[email protected]>
Reviewed-by: Miquel Raynal <[email protected]>
---
drivers/mtd/nand/ams-delta.c | 1 -
drivers/mtd/nand/atmel/nand-controller.c | 13 +++---------
drivers/mtd/nand/marvell_nand.c | 8 ++------
drivers/mtd/nand/nandsim.c | 35 ++++++++------------------------
drivers/mtd/nand/ndfc.c | 4 +---
drivers/mtd/nand/sunxi_nand.c | 4 +---
6 files changed, 15 insertions(+), 50 deletions(-)

diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 9de6572..6e7f6e0 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
/* Allocate memory for MTD device structure and private data */
this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
if (!this) {
- printk (KERN_WARNING "Unable to allocate E3 NAND MTD device structure.\n");
err = -ENOMEM;
goto out;
}
diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
index b2f00b3..b973d42 100644
--- a/drivers/mtd/nand/atmel/nand-controller.c
+++ b/drivers/mtd/nand/atmel/nand-controller.c
@@ -1615,10 +1615,8 @@ static int atmel_nand_register(struct atmel_nand *nand)
mtd->name = devm_kasprintf(nc->dev, GFP_KERNEL,
"%s:nand.%d", dev_name(nc->dev),
nand->cs[0].id);
- if (!mtd->name) {
- dev_err(nc->dev, "Failed to allocate mtd->name\n");
+ if (!mtd->name)
return -ENOMEM;
- }
}

ret = nand_scan_tail(mtd);
@@ -1657,10 +1655,8 @@ static struct atmel_nand *atmel_nand_create(struct atmel_nand_controller *nc,
nand = devm_kzalloc(nc->dev,
sizeof(*nand) + (numcs * sizeof(*nand->cs)),
GFP_KERNEL);
- if (!nand) {
- dev_err(nc->dev, "Failed to allocate NAND object\n");
+ if (!nand)
return ERR_PTR(-ENOMEM);
- }

nand->numcs = numcs;

@@ -2217,11 +2213,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
nc->sram.virt = gen_pool_dma_alloc(nc->sram.pool,
ATMEL_NFC_SRAM_SIZE,
&nc->sram.dma);
- if (!nc->sram.virt) {
- dev_err(nc->base.dev,
- "Could not allocate memory from the NFC SRAM pool\n");
+ if (!nc->sram.virt)
return -ENOMEM;
- }

return 0;
}
diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c
index 2196f2a..9dd2673 100644
--- a/drivers/mtd/nand/marvell_nand.c
+++ b/drivers/mtd/nand/marvell_nand.c
@@ -2307,10 +2307,8 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc,
(nsels *
sizeof(struct marvell_nand_chip_sel)),
GFP_KERNEL);
- if (!marvell_nand) {
- dev_err(dev, "could not allocate chip structure\n");
+ if (!marvell_nand)
return -ENOMEM;
- }

marvell_nand->nsels = nsels;
marvell_nand->selected_die = -1;
@@ -2506,10 +2504,8 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc,
mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL,
"%s:nand.%d", dev_name(nfc->dev),
marvell_nand->sels[0].cs);
- if (!mtd->name) {
- dev_err(nfc->dev, "Failed to allocate mtd->name\n");
+ if (!mtd->name)
return -ENOMEM;
- }
}

ret = nand_scan_tail(mtd);
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
index 44322a3..b6a5c09 100644
--- a/drivers/mtd/nand/nandsim.c
+++ b/drivers/mtd/nand/nandsim.c
@@ -569,13 +569,11 @@ static int __init alloc_device(struct nandsim *ns)
ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) *
sizeof(unsigned long));
if (!ns->pages_written) {
- NS_ERR("alloc_device: unable to allocate pages written array\n");
err = -ENOMEM;
goto err_close;
}
ns->file_buf = kmalloc(ns->geom.pgszoob, GFP_KERNEL);
if (!ns->file_buf) {
- NS_ERR("alloc_device: unable to allocate file buf\n");
err = -ENOMEM;
goto err_free;
}
@@ -584,10 +582,8 @@ static int __init alloc_device(struct nandsim *ns)
}

ns->pages = vmalloc(ns->geom.pgnum * sizeof(union ns_mem));
- if (!ns->pages) {
- NS_ERR("alloc_device: unable to allocate page array\n");
+ if (!ns->pages)
return -ENOMEM;
- }
for (i = 0; i < ns->geom.pgnum; i++) {
ns->pages[i].byte = NULL;
}
@@ -769,11 +765,8 @@ static int __init init_nandsim(struct mtd_info *mtd)

/* Allocate / initialize the internal buffer */
ns->buf.byte = kmalloc(ns->geom.pgszoob, GFP_KERNEL);
- if (!ns->buf.byte) {
- NS_ERR("init_nandsim: unable to allocate %u bytes for the internal buffer\n",
- ns->geom.pgszoob);
+ if (!ns->buf.byte)
return -ENOMEM;
- }
memset(ns->buf.byte, 0xFF, ns->geom.pgszoob);

return 0;
@@ -844,10 +837,8 @@ static int parse_weakblocks(void)
if (*w == ',')
w += 1;
wb = kzalloc(sizeof(*wb), GFP_KERNEL);
- if (!wb) {
- NS_ERR("unable to allocate memory.\n");
+ if (!wb)
return -ENOMEM;
- }
wb->erase_block_no = erase_block_no;
wb->max_erases = max_erases;
list_add(&wb->list, &weak_blocks);
@@ -895,10 +886,8 @@ static int parse_weakpages(void)
if (*w == ',')
w += 1;
wp = kzalloc(sizeof(*wp), GFP_KERNEL);
- if (!wp) {
- NS_ERR("unable to allocate memory.\n");
+ if (!wp)
return -ENOMEM;
- }
wp->page_no = page_no;
wp->max_writes = max_writes;
list_add(&wp->list, &weak_pages);
@@ -946,10 +935,8 @@ static int parse_gravepages(void)
if (*g == ',')
g += 1;
gp = kzalloc(sizeof(*gp), GFP_KERNEL);
- if (!gp) {
- NS_ERR("unable to allocate memory.\n");
+ if (!gp)
return -ENOMEM;
- }
gp->page_no = page_no;
gp->max_reads = max_reads;
list_add(&gp->list, &grave_pages);
@@ -1000,10 +987,8 @@ static int setup_wear_reporting(struct mtd_info *mtd)
return -ENOMEM;
}
erase_block_wear = kzalloc(mem, GFP_KERNEL);
- if (!erase_block_wear) {
- NS_ERR("Too many erase blocks for wear reporting\n");
+ if (!erase_block_wear)
return -ENOMEM;
- }
return 0;
}

@@ -1558,10 +1543,8 @@ static int prog_page(struct nandsim *ns, int num)
* again and deadlocks. This was seen in practice.
*/
mypage->byte = kmem_cache_alloc(ns->nand_pages_slab, GFP_NOFS);
- if (mypage->byte == NULL) {
- NS_ERR("prog_page: error allocating memory for page %d\n", ns->regs.row);
+ if (!mypage->byte)
return -1;
- }
memset(mypage->byte, 0xFF, ns->geom.pgszoob);
}

@@ -2209,10 +2192,8 @@ static int __init ns_init_module(void)
/* Allocate and initialize mtd_info, nand_chip and nandsim structures */
chip = kzalloc(sizeof(struct nand_chip) + sizeof(struct nandsim),
GFP_KERNEL);
- if (!chip) {
- NS_ERR("unable to allocate core structures.\n");
+ if (!chip)
return -ENOMEM;
- }
nsmtd = nand_to_mtd(chip);
nand = (struct nandsim *)(chip + 1);
nand_set_controller_data(chip, (void *)nand);
diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
index d8a8068..ea8d652 100644
--- a/drivers/mtd/nand/ndfc.c
+++ b/drivers/mtd/nand/ndfc.c
@@ -223,10 +223,8 @@ static int ndfc_probe(struct platform_device *ofdev)
dev_set_drvdata(&ofdev->dev, ndfc);

ndfc->ndfcbase = of_iomap(ofdev->dev.of_node, 0);
- if (!ndfc->ndfcbase) {
- dev_err(&ofdev->dev, "failed to get memory\n");
+ if (!ndfc->ndfcbase)
return -EIO;
- }

ccr = NDFC_CCR_BS(ndfc->chip_select);

diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
index f5a55c6..f38359f7 100644
--- a/drivers/mtd/nand/sunxi_nand.c
+++ b/drivers/mtd/nand/sunxi_nand.c
@@ -2030,10 +2030,8 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
sizeof(*chip) +
(nsels * sizeof(struct sunxi_nand_chip_sel)),
GFP_KERNEL);
- if (!chip) {
- dev_err(dev, "could not allocate chip\n");
+ if (!chip)
return -ENOMEM;
- }

chip->nsels = nsels;
chip->selected = -1;
--
2.7.4


2018-03-20 16:23:29

by Nicolas Ferre

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] mtd: nand: Remove print after allocation failure

On 20/03/2018 at 16:31, Arushi Singhal wrote:
> The prints after [k|v][m|z|c]alloc() etc. functions are not needed, because
> in case of failure, allocator will print their internal error prints
> anyway.
>
> Signed-off-by: Arushi Singhal <[email protected]>
> Reviewed-by: Miquel Raynal <[email protected]>
> ---
> drivers/mtd/nand/ams-delta.c | 1 -
> drivers/mtd/nand/atmel/nand-controller.c | 13 +++---------

For Atmel NAND driver:
Acked-by: Nicolas Ferre <[email protected]>

> drivers/mtd/nand/marvell_nand.c | 8 ++------
> drivers/mtd/nand/nandsim.c | 35 ++++++++------------------------
> drivers/mtd/nand/ndfc.c | 4 +---
> drivers/mtd/nand/sunxi_nand.c | 4 +---
> 6 files changed, 15 insertions(+), 50 deletions(-)
>
> diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
> index 9de6572..6e7f6e0 100644
> --- a/drivers/mtd/nand/ams-delta.c
> +++ b/drivers/mtd/nand/ams-delta.c
> @@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev)
> /* Allocate memory for MTD device structure and private data */
> this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL);
> if (!this) {
> - printk (KERN_WARNING "Unable to allocate E3 NAND MTD device structure.\n");
> err = -ENOMEM;
> goto out;
> }
> diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c
> index b2f00b3..b973d42 100644
> --- a/drivers/mtd/nand/atmel/nand-controller.c
> +++ b/drivers/mtd/nand/atmel/nand-controller.c
> @@ -1615,10 +1615,8 @@ static int atmel_nand_register(struct atmel_nand *nand)
> mtd->name = devm_kasprintf(nc->dev, GFP_KERNEL,
> "%s:nand.%d", dev_name(nc->dev),
> nand->cs[0].id);
> - if (!mtd->name) {
> - dev_err(nc->dev, "Failed to allocate mtd->name\n");
> + if (!mtd->name)
> return -ENOMEM;
> - }
> }
>
> ret = nand_scan_tail(mtd);
> @@ -1657,10 +1655,8 @@ static struct atmel_nand *atmel_nand_create(struct atmel_nand_controller *nc,
> nand = devm_kzalloc(nc->dev,
> sizeof(*nand) + (numcs * sizeof(*nand->cs)),
> GFP_KERNEL);
> - if (!nand) {
> - dev_err(nc->dev, "Failed to allocate NAND object\n");
> + if (!nand)
> return ERR_PTR(-ENOMEM);
> - }
>
> nand->numcs = numcs;
>
> @@ -2217,11 +2213,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc)
> nc->sram.virt = gen_pool_dma_alloc(nc->sram.pool,
> ATMEL_NFC_SRAM_SIZE,
> &nc->sram.dma);
> - if (!nc->sram.virt) {
> - dev_err(nc->base.dev,
> - "Could not allocate memory from the NFC SRAM pool\n");
> + if (!nc->sram.virt)
> return -ENOMEM;
> - }
>
> return 0;
> }
> diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c
> index 2196f2a..9dd2673 100644
> --- a/drivers/mtd/nand/marvell_nand.c
> +++ b/drivers/mtd/nand/marvell_nand.c
> @@ -2307,10 +2307,8 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc,
> (nsels *
> sizeof(struct marvell_nand_chip_sel)),
> GFP_KERNEL);
> - if (!marvell_nand) {
> - dev_err(dev, "could not allocate chip structure\n");
> + if (!marvell_nand)
> return -ENOMEM;
> - }
>
> marvell_nand->nsels = nsels;
> marvell_nand->selected_die = -1;
> @@ -2506,10 +2504,8 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc,
> mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL,
> "%s:nand.%d", dev_name(nfc->dev),
> marvell_nand->sels[0].cs);
> - if (!mtd->name) {
> - dev_err(nfc->dev, "Failed to allocate mtd->name\n");
> + if (!mtd->name)
> return -ENOMEM;
> - }
> }
>
> ret = nand_scan_tail(mtd);
> diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c
> index 44322a3..b6a5c09 100644
> --- a/drivers/mtd/nand/nandsim.c
> +++ b/drivers/mtd/nand/nandsim.c
> @@ -569,13 +569,11 @@ static int __init alloc_device(struct nandsim *ns)
> ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) *
> sizeof(unsigned long));
> if (!ns->pages_written) {
> - NS_ERR("alloc_device: unable to allocate pages written array\n");
> err = -ENOMEM;
> goto err_close;
> }
> ns->file_buf = kmalloc(ns->geom.pgszoob, GFP_KERNEL);
> if (!ns->file_buf) {
> - NS_ERR("alloc_device: unable to allocate file buf\n");
> err = -ENOMEM;
> goto err_free;
> }
> @@ -584,10 +582,8 @@ static int __init alloc_device(struct nandsim *ns)
> }
>
> ns->pages = vmalloc(ns->geom.pgnum * sizeof(union ns_mem));
> - if (!ns->pages) {
> - NS_ERR("alloc_device: unable to allocate page array\n");
> + if (!ns->pages)
> return -ENOMEM;
> - }
> for (i = 0; i < ns->geom.pgnum; i++) {
> ns->pages[i].byte = NULL;
> }
> @@ -769,11 +765,8 @@ static int __init init_nandsim(struct mtd_info *mtd)
>
> /* Allocate / initialize the internal buffer */
> ns->buf.byte = kmalloc(ns->geom.pgszoob, GFP_KERNEL);
> - if (!ns->buf.byte) {
> - NS_ERR("init_nandsim: unable to allocate %u bytes for the internal buffer\n",
> - ns->geom.pgszoob);
> + if (!ns->buf.byte)
> return -ENOMEM;
> - }
> memset(ns->buf.byte, 0xFF, ns->geom.pgszoob);
>
> return 0;
> @@ -844,10 +837,8 @@ static int parse_weakblocks(void)
> if (*w == ',')
> w += 1;
> wb = kzalloc(sizeof(*wb), GFP_KERNEL);
> - if (!wb) {
> - NS_ERR("unable to allocate memory.\n");
> + if (!wb)
> return -ENOMEM;
> - }
> wb->erase_block_no = erase_block_no;
> wb->max_erases = max_erases;
> list_add(&wb->list, &weak_blocks);
> @@ -895,10 +886,8 @@ static int parse_weakpages(void)
> if (*w == ',')
> w += 1;
> wp = kzalloc(sizeof(*wp), GFP_KERNEL);
> - if (!wp) {
> - NS_ERR("unable to allocate memory.\n");
> + if (!wp)
> return -ENOMEM;
> - }
> wp->page_no = page_no;
> wp->max_writes = max_writes;
> list_add(&wp->list, &weak_pages);
> @@ -946,10 +935,8 @@ static int parse_gravepages(void)
> if (*g == ',')
> g += 1;
> gp = kzalloc(sizeof(*gp), GFP_KERNEL);
> - if (!gp) {
> - NS_ERR("unable to allocate memory.\n");
> + if (!gp)
> return -ENOMEM;
> - }
> gp->page_no = page_no;
> gp->max_reads = max_reads;
> list_add(&gp->list, &grave_pages);
> @@ -1000,10 +987,8 @@ static int setup_wear_reporting(struct mtd_info *mtd)
> return -ENOMEM;
> }
> erase_block_wear = kzalloc(mem, GFP_KERNEL);
> - if (!erase_block_wear) {
> - NS_ERR("Too many erase blocks for wear reporting\n");
> + if (!erase_block_wear)
> return -ENOMEM;
> - }
> return 0;
> }
>
> @@ -1558,10 +1543,8 @@ static int prog_page(struct nandsim *ns, int num)
> * again and deadlocks. This was seen in practice.
> */
> mypage->byte = kmem_cache_alloc(ns->nand_pages_slab, GFP_NOFS);
> - if (mypage->byte == NULL) {
> - NS_ERR("prog_page: error allocating memory for page %d\n", ns->regs.row);
> + if (!mypage->byte)
> return -1;
> - }
> memset(mypage->byte, 0xFF, ns->geom.pgszoob);
> }
>
> @@ -2209,10 +2192,8 @@ static int __init ns_init_module(void)
> /* Allocate and initialize mtd_info, nand_chip and nandsim structures */
> chip = kzalloc(sizeof(struct nand_chip) + sizeof(struct nandsim),
> GFP_KERNEL);
> - if (!chip) {
> - NS_ERR("unable to allocate core structures.\n");
> + if (!chip)
> return -ENOMEM;
> - }
> nsmtd = nand_to_mtd(chip);
> nand = (struct nandsim *)(chip + 1);
> nand_set_controller_data(chip, (void *)nand);
> diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c
> index d8a8068..ea8d652 100644
> --- a/drivers/mtd/nand/ndfc.c
> +++ b/drivers/mtd/nand/ndfc.c
> @@ -223,10 +223,8 @@ static int ndfc_probe(struct platform_device *ofdev)
> dev_set_drvdata(&ofdev->dev, ndfc);
>
> ndfc->ndfcbase = of_iomap(ofdev->dev.of_node, 0);
> - if (!ndfc->ndfcbase) {
> - dev_err(&ofdev->dev, "failed to get memory\n");
> + if (!ndfc->ndfcbase)
> return -EIO;
> - }
>
> ccr = NDFC_CCR_BS(ndfc->chip_select);
>
> diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c
> index f5a55c6..f38359f7 100644
> --- a/drivers/mtd/nand/sunxi_nand.c
> +++ b/drivers/mtd/nand/sunxi_nand.c
> @@ -2030,10 +2030,8 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
> sizeof(*chip) +
> (nsels * sizeof(struct sunxi_nand_chip_sel)),
> GFP_KERNEL);
> - if (!chip) {
> - dev_err(dev, "could not allocate chip\n");
> + if (!chip)
> return -ENOMEM;
> - }
>
> chip->nsels = nsels;
> chip->selected = -1;
>


--
Nicolas Ferre