Skip to contentSkip to conversation

mtd: Remove unnecessary OOM messages

PATCH In review Jingoo Han 4 participants 12 messages Feb 6, 2014 – Feb 11, 2014 Memory technology devices (MTD)

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

cover mtd: Remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. For example, k.alloc and v.alloc failures use dump_stack().

Jingoo Han (8):
mtd: devices: elm: Remove unnecessary OOM messages
mtd: spear_smi: Remove unnecessary OOM messages
mtd: pmc551: Remove unnecessary OOM messages
mtd: plat-ram: Remove unnecessary OOM messages
mtd: lpddr: Remove unnecessary OOM messages
mtd: onenand: Remove unnecessary OOM messages
mtd: cfi: Remove unnecessary OOM messages
mtd: gen_probe: Remove unnecessary OOM messages

---
 drivers/mtd/chips/cfi_cmdset_0001.c |    8 ++------
 drivers/mtd/chips/cfi_cmdset_0002.c |    8 ++------
 drivers/mtd/chips/cfi_cmdset_0020.c |    2 --
 drivers/mtd/chips/cfi_probe.c       |    4 +---
 drivers/mtd/chips/cfi_util.c        |    4 +---
 drivers/mtd/chips/gen_probe.c       |    2 --
 drivers/mtd/devices/elm.c           |    4 +---
 drivers/mtd/devices/pmc551.c        |    7 +------
 drivers/mtd/devices/spear_smi.c     |    2 --
 drivers/mtd/lpddr/lpddr_cmds.c      |    4 +---
 drivers/mtd/lpddr/qinfo_probe.c     |    5 +----
 drivers/mtd/maps/plat-ram.c         |    1 -
 drivers/mtd/onenand/onenand_base.c  |    7 +------
 drivers/mtd/onenand/samsung.c       |    4 +---
 14 files changed, 12 insertions(+), 50 deletions(-)
author
#1 lore raw

PATCH 1/8 mtd: devices: elm: Remove unnecessary OOM messages

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/devices/elm.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/devices/elm.c +1 -3
index d1dd6a3..437ed3a 100644
@@ -354,10 +354,8 @@ static int elm_probe(struct platform_device *pdev)
 	struct elm_info *info;
 
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
-	if (!info) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (!info)
 		return -ENOMEM;
-	}
 
 	info->dev = &pdev->dev;
 
Signature · 1 line
1.7.10.4
Acked-by on v1 1/8
#2 lore raw

RE: [PATCH 1/8] mtd: devices: elm: Remove unnecessary OOM messages

Quoted 27 lines

From: Jingoo Han [mailto:[email protected]]

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
drivers/mtd/devices/elm.c | 4 +---

1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/devices/elm.c +1 -4
index d1dd6a3..437ed3a 100644
@@ -354,10 +354,8 @@ static int elm_probe(struct platform_device *pdev)
 	struct elm_info *info;
 
 	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
-	if (!info) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (!info)
 		return -ENOMEM;
-	}
 
 	info->dev = &pdev->dev;
 
--
Quoted 2 lines

1.7.10.4

+ [email protected]

with regards, pekon

author
#3 lore raw

PATCH 2/8 mtd: spear_smi: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/devices/spear_smi.c |    2 --
 1 file changed, 2 deletions(-)
drivers/mtd/devices/spear_smi.c +0 -2
index 4238214..363da96 100644
@@ -913,7 +913,6 @@ static int spear_smi_probe(struct platform_device *pdev)
 	if (np) {
 		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
 		if (!pdata) {
-			pr_err("%s: ERROR: no memory", __func__);
 			ret = -ENOMEM;
 			goto err;
 		}
@@ -943,7 +942,6 @@ static int spear_smi_probe(struct platform_device *pdev)
 	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_ATOMIC);
 	if (!dev) {
 		ret = -ENOMEM;
-		dev_err(&pdev->dev, "mem alloc fail\n");
 		goto err;
 	}
 
Signature · 1 line
1.7.10.4
Acked-by on v1 2/8
#4 lore raw

Re: [PATCH 2/8] mtd: spear_smi: Remove unnecessary OOM messages

Quoted 21 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/devices/spear_smi.c |    2 --
 1 file changed, 2 deletions(-)
drivers/mtd/devices/spear_smi.c +0 -1
index 4238214..363da96 100644
@@ -913,7 +913,6 @@ static int spear_smi_probe(struct platform_device *pdev)
        if (np) {
                pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
                if (!pdata) {
-                       pr_err("%s: ERROR: no memory", __func__);
                        ret = -ENOMEM;
                        goto err;
                }

drivers/mtd/devices/spear_smi.c static int spear_smi_probe(struct platform_device *pdev) · line 946

Quoted 6 lines
drivers/mtd/devices/spear_smi.c +0 -1
@@ -943,7 +942,6 @@ static int spear_smi_probe(struct platform_device *pdev)
        dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_ATOMIC);
        if (!dev) {
                ret = -ENOMEM;
-               dev_err(&pdev->dev, "mem alloc fail\n");
                goto err;
        }
author
#5 lore raw

PATCH 3/8 mtd: pmc551: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/devices/pmc551.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/mtd/devices/pmc551.c +1 -6
index 0c51b98..f02603e 100644
@@ -725,16 +725,11 @@ static int __init init_pmc551(void)
 		}
 
 		mtd = kzalloc(sizeof(struct mtd_info), GFP_KERNEL);
-		if (!mtd) {
-			printk(KERN_NOTICE "pmc551: Cannot allocate new MTD "
-				"device.\n");
+		if (!mtd)
 			break;
-		}
 
 		priv = kzalloc(sizeof(struct mypriv), GFP_KERNEL);
 		if (!priv) {
-			printk(KERN_NOTICE "pmc551: Cannot allocate new MTD "
-				"device.\n");
 			kfree(mtd);
 			break;
 		}
Signature · 1 line
1.7.10.4
author
#6 lore raw

PATCH 4/8 mtd: plat-ram: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/maps/plat-ram.c |    1 -
 1 file changed, 1 deletion(-)
drivers/mtd/maps/plat-ram.c +0 -1
index 76ace85..d597e89 100644
@@ -137,7 +137,6 @@ static int platram_probe(struct platform_device *pdev)
 
 	info = kzalloc(sizeof(*info), GFP_KERNEL);
 	if (info == NULL) {
-		dev_err(&pdev->dev, "no memory for flash info\n");
 		err = -ENOMEM;
 		goto exit_error;
 	}
Signature · 1 line
1.7.10.4
author
#7 lore raw

PATCH 5/8 mtd: lpddr: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/lpddr/lpddr_cmds.c  |    4 +---
 drivers/mtd/lpddr/qinfo_probe.c |    5 +----
 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/mtd/lpddr/lpddr_cmds.c +1 -3
index d38b646..018c75f 100644
@@ -55,10 +55,8 @@ struct mtd_info *lpddr_cmdset(struct map_info *map)
 	int i, j;
 
 	mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
-	if (!mtd) {
-		printk(KERN_ERR "Failed to allocate memory for MTD device\n");
+	if (!mtd)
 		return NULL;
-	}
 	mtd->priv = map;
 	mtd->type = MTD_NORFLASH;
 
drivers/mtd/lpddr/qinfo_probe.c +1 -4
index 45abed6..69f2112 100644
@@ -135,11 +135,8 @@ static int lpddr_chip_setup(struct map_info *map, struct lpddr_private *lpddr)
 {
 
 	lpddr->qinfo = kzalloc(sizeof(struct qinfo_chip), GFP_KERNEL);
-	if (!lpddr->qinfo) {
-		printk(KERN_WARNING "%s: no memory for LPDDR qinfo structure\n",
-				map->name);
+	if (!lpddr->qinfo)
 		return 0;
-	}
 
 	/* Get the ManuID */
 	lpddr->ManufactId = CMDVAL(map_read(map, map->pfow_base + PFOW_MANUFACTURER_ID));
Signature · 1 line
1.7.10.4
author
#8 lore raw

PATCH 6/8 mtd: onenand: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/onenand/onenand_base.c |    7 +------
 drivers/mtd/onenand/samsung.c      |    4 +---
 2 files changed, 2 insertions(+), 9 deletions(-)
drivers/mtd/onenand/onenand_base.c +1 -6
index 531ccbc..e886d7a 100644
@@ -3994,11 +3994,8 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
 	/* Allocate buffers, if necessary */
 	if (!this->page_buf) {
 		this->page_buf = kzalloc(mtd->writesize, GFP_KERNEL);
-		if (!this->page_buf) {
-			printk(KERN_ERR "%s: Can't allocate page_buf\n",
-				__func__);
+		if (!this->page_buf)
 			return -ENOMEM;
-		}
 #ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE
 		this->verify_buf = kzalloc(mtd->writesize, GFP_KERNEL);
 		if (!this->verify_buf) {
@@ -4011,8 +4008,6 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
 	if (!this->oob_buf) {
 		this->oob_buf = kzalloc(mtd->oobsize, GFP_KERNEL);
 		if (!this->oob_buf) {
-			printk(KERN_ERR "%s: Can't allocate oob_buf\n",
-				__func__);
 			if (this->options & ONENAND_PAGEBUF_ALLOC) {
 				this->options &= ~ONENAND_PAGEBUF_ALLOC;
 				kfree(this->page_buf);
drivers/mtd/onenand/samsung.c +1 -3
index df7400d..b1a792f 100644
@@ -872,10 +872,8 @@ static int s3c_onenand_probe(struct platform_device *pdev)
 
 	size = sizeof(struct mtd_info) + sizeof(struct onenand_chip);
 	mtd = kzalloc(size, GFP_KERNEL);
-	if (!mtd) {
-		dev_err(&pdev->dev, "failed to allocate memory\n");
+	if (!mtd)
 		return -ENOMEM;
-	}
 
 	onenand = kzalloc(sizeof(struct s3c_onenand), GFP_KERNEL);
 	if (!onenand) {
Signature · 1 line
1.7.10.4
author
#9 lore raw

PATCH 7/8 mtd: cfi: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/chips/cfi_cmdset_0001.c |    8 ++------
 drivers/mtd/chips/cfi_cmdset_0002.c |    8 ++------
 drivers/mtd/chips/cfi_cmdset_0020.c |    2 --
 drivers/mtd/chips/cfi_probe.c       |    4 +---
 drivers/mtd/chips/cfi_util.c        |    4 +---
 5 files changed, 6 insertions(+), 20 deletions(-)
drivers/mtd/chips/cfi_cmdset_0001.c +2 -6
index a19719e..5e74c86 100644
@@ -434,10 +434,8 @@ struct mtd_info *cfi_cmdset_0001(struct map_info *map, int primary)
 	int i;
 
 	mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
-	if (!mtd) {
-		printk(KERN_ERR "Failed to allocate memory for MTD device\n");
+	if (!mtd)
 		return NULL;
-	}
 	mtd->priv = map;
 	mtd->type = MTD_NORFLASH;
 
@@ -563,10 +561,8 @@ static struct mtd_info *cfi_intelext_setup(struct mtd_info *mtd)
 	mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
 	mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
 			* mtd->numeraseregions, GFP_KERNEL);
-	if (!mtd->eraseregions) {
-		printk(KERN_ERR "Failed to allocate memory for MTD erase region info\n");
+	if (!mtd->eraseregions)
 		goto setup_err;
-	}
 
 	for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
 		unsigned long ernum, ersize;
drivers/mtd/chips/cfi_cmdset_0002.c +2 -6
index 718244d..e21fde9 100644
@@ -506,10 +506,8 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
 	int i;
 
 	mtd = kzalloc(sizeof(*mtd), GFP_KERNEL);
-	if (!mtd) {
-		printk(KERN_WARNING "Failed to allocate memory for MTD device\n");
+	if (!mtd)
 		return NULL;
-	}
 	mtd->priv = map;
 	mtd->type = MTD_NORFLASH;
 
@@ -660,10 +658,8 @@ static struct mtd_info *cfi_amdstd_setup(struct mtd_info *mtd)
 	mtd->numeraseregions = cfi->cfiq->NumEraseRegions * cfi->numchips;
 	mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
 				    * mtd->numeraseregions, GFP_KERNEL);
-	if (!mtd->eraseregions) {
-		printk(KERN_WARNING "Failed to allocate memory for MTD erase region info\n");
+	if (!mtd->eraseregions)
 		goto setup_err;
-	}
 
 	for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
 		unsigned long ernum, ersize;
drivers/mtd/chips/cfi_cmdset_0020.c +0 -2
index 8852942..6293855 100644
@@ -175,7 +175,6 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
 	//printk(KERN_DEBUG "number of CFI chips: %d\n", cfi->numchips);
 
 	if (!mtd) {
-		printk(KERN_ERR "Failed to allocate memory for MTD device\n");
 		kfree(cfi->cmdset_priv);
 		return NULL;
 	}
@@ -188,7 +187,6 @@ static struct mtd_info *cfi_staa_setup(struct map_info *map)
 	mtd->eraseregions = kmalloc(sizeof(struct mtd_erase_region_info)
 			* mtd->numeraseregions, GFP_KERNEL);
 	if (!mtd->eraseregions) {
-		printk(KERN_ERR "Failed to allocate memory for MTD erase region info\n");
 		kfree(cfi->cmdset_priv);
 		kfree(mtd);
 		return NULL;
drivers/mtd/chips/cfi_probe.c +1 -3
index d255352..e8d0164 100644
@@ -168,10 +168,8 @@ static int __xipram cfi_chip_setup(struct map_info *map,
 		return 0;
 
 	cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL);
-	if (!cfi->cfiq) {
-		printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name);
+	if (!cfi->cfiq)
 		return 0;
-	}
 
 	memset(cfi->cfiq,0,sizeof(struct cfi_ident));
 
drivers/mtd/chips/cfi_util.c +1 -3
index f992418..08049f6 100644
@@ -116,10 +116,8 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
 	printk(KERN_INFO "%s Extended Query Table at 0x%4.4X\n", name, adr);
 
 	extp = kmalloc(size, GFP_KERNEL);
-	if (!extp) {
-		printk(KERN_ERR "Failed to allocate memory\n");
+	if (!extp)
 		goto out;
-	}
 
 #ifdef CONFIG_MTD_XIP
 	local_irq_disable();
Signature · 1 line
1.7.10.4
author
#10 lore raw

PATCH 8/8 mtd: gen_probe: Remove unnecessary OOM messages

In reply to Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message.

---
 drivers/mtd/chips/gen_probe.c |    2 --
 1 file changed, 2 deletions(-)
drivers/mtd/chips/gen_probe.c +0 -2
index ffb36ba..b57ceea 100644
@@ -114,7 +114,6 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
 	mapsize = sizeof(long) * DIV_ROUND_UP(max_chips, BITS_PER_LONG);
 	chip_map = kzalloc(mapsize, GFP_KERNEL);
 	if (!chip_map) {
-		printk(KERN_WARNING "%s: kmalloc failed for CFI chip map\n", map->name);
 		kfree(cfi.cfiq);
 		return NULL;
 	}
@@ -139,7 +138,6 @@ static struct cfi_private *genprobe_ident_chips(struct map_info *map, struct chi
 	retcfi = kmalloc(sizeof(struct cfi_private) + cfi.numchips * sizeof(struct flchip), GFP_KERNEL);
 
 	if (!retcfi) {
-		printk(KERN_WARNING "%s: kmalloc failed for CFI private structure\n", map->name);
 		kfree(cfi.cfiq);
 		kfree(chip_map);
 		return NULL;
Signature · 1 line
1.7.10.4
#11 lore raw
In reply to Jingoo Han
Quoted 4 lines · Jingoo Han

The site-specific OOM messages are unnecessary, because they duplicate the MM subsystem generic OOM message. For example, k.alloc and v.alloc failures use dump_stack().

Quoted 9 lines

Jingoo Han (8):
mtd: devices: elm: Remove unnecessary OOM messages
mtd: spear_smi: Remove unnecessary OOM messages
mtd: pmc551: Remove unnecessary OOM messages
mtd: plat-ram: Remove unnecessary OOM messages
mtd: lpddr: Remove unnecessary OOM messages
mtd: onenand: Remove unnecessary OOM messages
mtd: cfi: Remove unnecessary OOM messages
mtd: gen_probe: Remove unnecessary OOM messages

Pushed all 8 to l2-mtd.git. Thanks.

Have you ever considered using a tool like coccinelle to do this sort of work? You send so many of these boilerplate patch series, I would think it would help everyone to just get them out of the way with scripted assistance. And you could then more easily catch new introductions if they slip through the review process.

Brian