public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Kay Sievers <kay@vrfy.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] printk: remove some dead code
Date: Tue, 3 Jul 2012 13:45:11 +0300	[thread overview]
Message-ID: <20120703104511.GA29501@elgon.mountain> (raw)

Static checkers complain about the impossible condition here.

In 084681d14e ('printk: flush continuation lines immediately to
console'), we changed msg->level from being a u16 to being an unsigned
3 bit bitfield.  That means we can remove the code here to handle log
levels which are in the tens or hundreds column.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/kernel/printk.c b/kernel/printk.c
index 660ba72..3edc531 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -822,15 +822,10 @@ static size_t print_prefix(const struct log *msg, bool syslog, char *buf)
 	size_t len = 0;
 
 	if (syslog) {
-		if (buf) {
+		if (buf)
 			len += sprintf(buf, "<%u>", msg->level);
-		} else {
+		else
 			len += 3;
-			if (msg->level > 9)
-				len++;
-			if (msg->level > 99)
-				len++;
-		}
 	}
 
 	len += print_time(msg->ts_nsec, buf ? buf + len : NULL);

             reply	other threads:[~2012-07-03 10:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-03 10:45 Dan Carpenter [this message]
2012-07-03 11:21 ` [patch] printk: remove some dead code Kay Sievers
2012-07-03 17:59   ` Kay Sievers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120703104511.GA29501@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kay@vrfy.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox