From patchwork Sat Jan 12 10:34:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tormod Volden X-Patchwork-Id: 211487 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 050DF2C00F6 for ; Sat, 12 Jan 2013 21:35:39 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TtyQA-00046I-4C; Sat, 12 Jan 2013 10:34:38 +0000 Received: from mail-ea0-f177.google.com ([209.85.215.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TtyQ7-00045z-AX for linux-mtd@lists.infradead.org; Sat, 12 Jan 2013 10:34:36 +0000 Received: by mail-ea0-f177.google.com with SMTP id c10so1005090eaa.36 for ; Sat, 12 Jan 2013 02:34:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to; bh=3QoUqLL221BbWUUwiouxb9HBZ31SHvfD4GIiH7g/cCM=; b=G4Nksq8Ko/2603IyKq2SnCjAurOsllAAeL3Xialsn91n/Dyo5itWdN+J6RK2g8xJnx HJJDmQ92R5pPyUaN8HVbxEi6JNsUayPZ+M8QPbSAa2VUolsojsu2Gi+pKIV1+g3wJolQ nP9Xd4ddwByaA3Bp7TaTtoqGrALuJwb983rC7ue3GDQznfOjj+eW3Trtw3Z6McrSuFbl ISMJAw49x7Pm4BiAwBNtJvdeS2oxzLkQpmQ5B++V6/ZtJhJXARff/Mb3ZYYTLdUVqHuw WKTqIQhRS1BD51WIiv8fO9RzcFFTLU21PZoA57R56XkhpfIgaezrTUyqMgWZFwBkMM7N SB6A== X-Received: by 10.14.209.193 with SMTP id s41mr210667223eeo.9.1357986873396; Sat, 12 Jan 2013 02:34:33 -0800 (PST) Received: from acer-tormod.v.cablecom.net (80-219-114-78.dclient.hispeed.ch. [80.219.114.78]) by mx.google.com with ESMTPS id 44sm12289097eek.0.2013.01.12.02.34.31 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 12 Jan 2013 02:34:32 -0800 (PST) From: Tormod Volden To: linux-mtd@lists.infradead.org Subject: [PATCH v2] mtd/nand: Print source of error message Date: Sat, 12 Jan 2013 11:34:27 +0100 Message-Id: <1357986867-22396-1-git-send-email-lists.tormod@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <50F12660.6010208@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130112_053435_595801_27C4A357 X-CRM114-Status: GOOD ( 12.65 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (lists.tormod[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.177 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Vikram Narayanan X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Tormod Volden Add the function name to the error message. These messages are not very helpful: [183356.176682] uncorrectable error : [183356.180273] uncorrectable error : [183356.184194] uncorrectable error : [183356.187773] uncorrectable error : [183356.191280] uncorrectable error : Signed-off-by: Tormod Volden --- Vikram Narayanan wrote: > Better to use %s and __func__. > Despite adding the function name, it'd be much better to briefly convey > what has happened. Hi Vikram, I agree. I also replaced printk with pr_err which seems to be preferred nowadays. Sorry I can not help much with the better solution since I don't know this code. The function is called via function pointers so it is not straight- forward to find all callers and check their code. Regards, Tormod drivers/mtd/nand/nand_ecc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c index b7cfe0d..526fa3b 100644 --- a/drivers/mtd/nand/nand_ecc.c +++ b/drivers/mtd/nand/nand_ecc.c @@ -55,8 +55,7 @@ struct mtd_info; #define MODULE_AUTHOR(x) /* x */ #define MODULE_DESCRIPTION(x) /* x */ -#define printk printf -#define KERN_ERR "" +#define pr_err printf #endif /* @@ -507,7 +506,7 @@ int __nand_correct_data(unsigned char *buf, if ((bitsperbyte[b0] + bitsperbyte[b1] + bitsperbyte[b2]) == 1) return 1; /* error in ECC data; no action needed */ - printk(KERN_ERR "uncorrectable error : "); + pr_err("%s: uncorrectable error : ", __func__); return -1; } EXPORT_SYMBOL(__nand_correct_data);