From ad41641effaa6507dfb48013ba8174e35c60263e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Horia=20Geant=C4=83?= <horia.geanta@nxp.com>
Date: Tue, 19 Feb 2019 09:57:59 +0200
Subject: [PATCH] crypto: caam - make dev_dbg() format string constant
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Changing dev_info() to dev_dbg() has exposed an issue with the format
string, which is not constant - and leads to compilation failure in case
CONFIG_DYNAMIC_DEBUG=y:

In file included from ./include/linux/printk.h:334:0,
                 from ./include/linux/kernel.h:14,
                 from drivers/crypto/caam/compat.h:9,
                 from drivers/crypto/caam/sm_test.c:23:
drivers/crypto/caam/sm_test.c: In function 'key_display':
./include/linux/dynamic_debug.h:75:16: error: initializer element is not constant
  static struct _ddebug  __aligned(8)   \
                ^
./include/linux/dynamic_debug.h:111:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_KEY'
  DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0)
  ^
./include/linux/dynamic_debug.h:133:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
  ^
./include/linux/device.h:1351:2: note: in expansion of macro 'dynamic_dev_dbg'
  dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
  ^
drivers/crypto/caam/sm_test.c:77:2: note: in expansion of macro 'dev_dbg'
  dev_dbg(dev, label);
  ^
./include/linux/dynamic_debug.h:75:16: error: (near initialization for 'descriptor.format')
  static struct _ddebug  __aligned(8)   \
                ^
./include/linux/dynamic_debug.h:111:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA_KEY'
  DEFINE_DYNAMIC_DEBUG_METADATA_KEY(name, fmt, 0, 0)
  ^
./include/linux/dynamic_debug.h:133:2: note: in expansion of macro 'DEFINE_DYNAMIC_DEBUG_METADATA'
  DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);  \
  ^
./include/linux/device.h:1351:2: note: in expansion of macro 'dynamic_dev_dbg'
  dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
  ^
drivers/crypto/caam/sm_test.c:77:2: note: in expansion of macro 'dev_dbg'
  dev_dbg(dev, label);
  ^
make[3]: *** [drivers/crypto/caam/sm_test.o] Error 1

Fixes: c59d342def7b ("crypto: caam - lower SM test verbosity")
Suggested-by: Leonard Crestez <leonard.crestez@nxp.com>
Reviewed-by: Leonard Crestez <leonard.crestez@nxp.com>
Signed-off-by: Horia Geantă <horia.geanta@nxp.com>
---
 drivers/crypto/caam/sm_test.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/caam/sm_test.c b/drivers/crypto/caam/sm_test.c
index 7eef4c6b9c2cb2..60fe18a3275f7d 100644
--- a/drivers/crypto/caam/sm_test.c
+++ b/drivers/crypto/caam/sm_test.c
@@ -70,11 +70,12 @@ static u8 clrkey[] = {
 	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
 };
 
-static void key_display(struct device *dev, u8 *label, u16 size, u8 *key)
+static void key_display(struct device *dev, const char *label, u16 size,
+			u8 *key)
 {
 	unsigned i;
 
-	dev_dbg(dev, label);
+	dev_dbg(dev, "%s", label);
 	for (i = 0; i < size; i += 8)
 		dev_dbg(dev,
 			"[%04d] %02x %02x %02x %02x %02x %02x %02x %02x\n",
-- 
GitLab