diff mbox

cxl: Remove useless precision specifiers

Message ID 1424438782-31545-1-git-send-email-linux@rasmusvillemoes.dk (mailing list archive)
State Rejected
Delegated to: Michael Ellerman
Headers show

Commit Message

Rasmus Villemoes Feb. 20, 2015, 1:26 p.m. UTC
C99 says that a precision given as simply '.' with no following digits
or * should be interpreted as 0. The kernel's printf implementation,
however, treats this case as if the precision was omitted. C99 also
says that if both the precision and value are 0, no digits should be
printed. Even if the kernel followed C99 to the letter, I don't think
that would be particularly useful in these cases, so just remove the
precision specifiers.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
---
 drivers/misc/cxl/irq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ian Munsie Feb. 23, 2015, 3:40 a.m. UTC | #1
Excerpts from Rasmus Villemoes's message of 2015-02-21 00:26:22 +1100:
> C99 says that a precision given as simply '.' with no following digits
> or * should be interpreted as 0. The kernel's printf implementation,
> however, treats this case as if the precision was omitted. C99 also
> says that if both the precision and value are 0, no digits should be
> printed. Even if the kernel followed C99 to the letter, I don't think
> that would be particularly useful in these cases, so just remove the
> precision specifiers.

Nice catch Rasmus, but I think a better patch would be one that adds the
missing precision (%.16llx).

Cheers,
-Ian
Joe Perches Feb. 23, 2015, 6:42 a.m. UTC | #2
On Mon, 2015-02-23 at 14:40 +1100, Ian Munsie wrote:
> Excerpts from Rasmus Villemoes's message of 2015-02-21 00:26:22 +1100:
> > C99 says that a precision given as simply '.' with no following digits
> > or * should be interpreted as 0. The kernel's printf implementation,
> > however, treats this case as if the precision was omitted. C99 also
> > says that if both the precision and value are 0, no digits should be
> > printed. Even if the kernel followed C99 to the letter, I don't think
> > that would be particularly useful in these cases, so just remove the
> > precision specifiers.
> 
> Nice catch Rasmus, but I think a better patch would be one that adds the
> missing precision (%.16llx).

The kernel much more commonly uses %016llx

$ git grep "%016llx" | grep -v staging | wc -l
792
$ git grep "%\.16llx" | grep -v staging | wc -l
36
diff mbox

Patch

diff --git a/drivers/misc/cxl/irq.c b/drivers/misc/cxl/irq.c
index c8929c526691..46635a8dbeae 100644
--- a/drivers/misc/cxl/irq.c
+++ b/drivers/misc/cxl/irq.c
@@ -147,7 +147,7 @@  static irqreturn_t cxl_irq(int irq, void *data, struct cxl_irq_info *irq_info)
 	if (dsisr & CXL_PSL_DSISR_An_PE)
 		return handle_psl_slice_error(ctx, dsisr, irq_info->errstat);
 	if (dsisr & CXL_PSL_DSISR_An_AE) {
-		pr_devel("CXL interrupt: AFU Error %.llx\n", irq_info->afu_err);
+		pr_devel("CXL interrupt: AFU Error %llx\n", irq_info->afu_err);
 
 		if (ctx->pending_afu_err) {
 			/*
@@ -158,7 +158,7 @@  static irqreturn_t cxl_irq(int irq, void *data, struct cxl_irq_info *irq_info)
 			 * probably best that we log them somewhere:
 			 */
 			dev_err_ratelimited(&ctx->afu->dev, "CXL AFU Error "
-					    "undelivered to pe %i: %.llx\n",
+					    "undelivered to pe %i: %llx\n",
 					    ctx->pe, irq_info->afu_err);
 		} else {
 			spin_lock(&ctx->lock);