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 <arushisinghal19971...@gmail.com>
---
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

Reply via email to