* [PATCH] mtdoops: Delete an error message for a failed memory allocation in two functions
@ 2018-01-04 20:24 SF Markus Elfring
0 siblings, 0 replies; only message in thread
From: SF Markus Elfring @ 2018-01-04 20:24 UTC (permalink / raw)
To: linux-mtd, Boris Brezillon, Brian Norris, Cyrille Pitchen,
David Woodhouse, Marek Vasut, Richard Weinberger
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 4 Jan 2018 21:10:56 +0100
Omit an extra message for a memory allocation failure in these functions.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/mtd/mtdoops.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 97bb8f6304d4..ea8619ec970b 100644
--- a/drivers/mtd/mtdoops.c
+++ b/drivers/mtd/mtdoops.c
@@ -352,10 +352,8 @@ static void mtdoops_notify_add(struct mtd_info *mtd)
/* oops_page_used is a bit field */
cxt->oops_page_used = vmalloc(DIV_ROUND_UP(mtdoops_pages,
BITS_PER_LONG) * sizeof(unsigned long));
- if (!cxt->oops_page_used) {
- printk(KERN_ERR "mtdoops: could not allocate page array\n");
+ if (!cxt->oops_page_used)
return;
- }
cxt->dump.max_reason = KMSG_DUMP_OOPS;
cxt->dump.dump = mtdoops_do_dump;
@@ -420,10 +418,9 @@ static int __init mtdoops_init(void)
cxt->mtd_index = mtd_index;
cxt->oops_buf = vmalloc(record_size);
- if (!cxt->oops_buf) {
- printk(KERN_ERR "mtdoops: failed to allocate buffer workspace\n");
+ if (!cxt->oops_buf)
return -ENOMEM;
- }
+
memset(cxt->oops_buf, 0xff, record_size);
INIT_WORK(&cxt->work_erase, mtdoops_workfunc_erase);
--
2.15.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-01-04 20:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-04 20:24 [PATCH] mtdoops: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome