Re: [PATCH] staging: ccree: Fix format/argument mismatches

2017-07-31 Thread Joe Perches
On Mon, 2017-07-31 at 09:39 +0300, Gilad Ben-Yossef wrote:
> On Sun, Jul 30, 2017 at 7:45 PM, Joe Perches  wrote:
> > By default, debug logging is disabled by CC_DEBUG not being defined.
> > 
> > Convert SSI_LOG_DEBUG to use no_printk instead of an empty define
> > to validate formats and arguments.
> > 
> > Fix fallout.
> > 
> > Miscellanea:
> > 
> > o One of the conversions now uses %pR instead of multiple uses of %pad
> 
> This looks great (I didn't know about no_printk) but does not seem to
> apply on top of
> staging-next.

Applies to next-20170728

b2cf822e075f7a7e7ced8c50af600f9edf5ccc31



Re: [PATCH] staging: ccree: Fix format/argument mismatches

2017-07-31 Thread Gilad Ben-Yossef
On Sun, Jul 30, 2017 at 7:45 PM, Joe Perches  wrote:
> By default, debug logging is disabled by CC_DEBUG not being defined.
>
> Convert SSI_LOG_DEBUG to use no_printk instead of an empty define
> to validate formats and arguments.
>
> Fix fallout.
>
> Miscellanea:
>
> o One of the conversions now uses %pR instead of multiple uses of %pad

This looks great (I didn't know about no_printk) but does not seem to
apply on top of
staging-next.


Thanks,
Gilad

>
> Signed-off-by: Joe Perches 
> ---
>  drivers/staging/ccree/ssi_aead.c|  8 
>  drivers/staging/ccree/ssi_buffer_mgr.c  | 29 +
>  drivers/staging/ccree/ssi_cipher.c  | 10 +-
>  drivers/staging/ccree/ssi_driver.c  |  5 ++---
>  drivers/staging/ccree/ssi_driver.h  |  2 +-
>  drivers/staging/ccree/ssi_hash.c| 32 
>  drivers/staging/ccree/ssi_request_mgr.c |  6 +++---
>  7 files changed, 44 insertions(+), 48 deletions(-)
>
> diff --git a/drivers/staging/ccree/ssi_aead.c 
> b/drivers/staging/ccree/ssi_aead.c
> index ea29b8a1a71d..9376bf8b8c61 100644
> --- a/drivers/staging/ccree/ssi_aead.c
> +++ b/drivers/staging/ccree/ssi_aead.c
> @@ -103,7 +103,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
> if (ctx->enckey) {
> dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, 
> ctx->enckey_dma_addr);
> SSI_LOG_DEBUG("Freed enckey DMA buffer 
> enckey_dma_addr=%pad\n",
> - ctx->enckey_dma_addr);
> + >enckey_dma_addr);
> ctx->enckey_dma_addr = 0;
> ctx->enckey = NULL;
> }
> @@ -117,7 +117,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
>   xcbc->xcbc_keys_dma_addr);
> }
> SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer 
> xcbc_keys_dma_addr=%pad\n",
> - xcbc->xcbc_keys_dma_addr);
> + >xcbc_keys_dma_addr);
> xcbc->xcbc_keys_dma_addr = 0;
> xcbc->xcbc_keys = NULL;
> } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */
> @@ -128,7 +128,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
>   hmac->ipad_opad,
>   hmac->ipad_opad_dma_addr);
> SSI_LOG_DEBUG("Freed ipad_opad DMA buffer 
> ipad_opad_dma_addr=%pad\n",
> - hmac->ipad_opad_dma_addr);
> + >ipad_opad_dma_addr);
> hmac->ipad_opad_dma_addr = 0;
> hmac->ipad_opad = NULL;
> }
> @@ -137,7 +137,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
>   hmac->padded_authkey,
>   hmac->padded_authkey_dma_addr);
> SSI_LOG_DEBUG("Freed padded_authkey DMA buffer 
> padded_authkey_dma_addr=%pad\n",
> - hmac->padded_authkey_dma_addr);
> + >padded_authkey_dma_addr);
> hmac->padded_authkey_dma_addr = 0;
> hmac->padded_authkey = NULL;
> }
> diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
> b/drivers/staging/ccree/ssi_buffer_mgr.c
> index 6579a54f9dc4..e13184d1d165 100644
> --- a/drivers/staging/ccree/ssi_buffer_mgr.c
> +++ b/drivers/staging/ccree/ssi_buffer_mgr.c
> @@ -14,6 +14,7 @@
>   * along with this program; if not, see .
>   */
>
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -33,14 +34,10 @@
>  #include "ssi_hash.h"
>  #include "ssi_aead.h"
>
> -#ifdef CC_DEBUG
>  #define GET_DMA_BUFFER_TYPE(buff_type) ( \
> ((buff_type) == SSI_DMA_BUF_NULL) ? "BUF_NULL" : \
> ((buff_type) == SSI_DMA_BUF_DLLI) ? "BUF_DLLI" : \
> ((buff_type) == SSI_DMA_BUF_MLLI) ? "BUF_MLLI" : "BUF_INVALID")
> -#else
> -#define GET_DMA_BUFFER_TYPE(buff_type)
> -#endif
>
>  enum dma_buffer_type {
> DMA_NULL_TYPE = -1,
> @@ -262,7 +259,7 @@ static int ssi_buffer_mgr_generate_mlli(
> SSI_LOG_DEBUG("MLLI params: "
>  "virt_addr=%pK dma_addr=%pad mlli_len=0x%X\n",
>mlli_params->mlli_virt_addr,
> -  mlli_params->mlli_dma_addr,
> +  _params->mlli_dma_addr,
>mlli_params->mlli_len);
>
>  build_mlli_exit:
> @@ -278,7 +275,7 @@ static inline void ssi_buffer_mgr_add_buffer_entry(
>
> SSI_LOG_DEBUG("index=%u single_buff=%pad "
>  "buffer_len=0x%08X is_last=%d\n",
> -index, buffer_dma, buffer_len, is_last_entry);
> +index, _dma, buffer_len, is_last_entry);
> sgl_data->nents[index] = 1;
> 

[PATCH] staging: ccree: Fix format/argument mismatches

2017-07-30 Thread Joe Perches
By default, debug logging is disabled by CC_DEBUG not being defined.

Convert SSI_LOG_DEBUG to use no_printk instead of an empty define
to validate formats and arguments.

Fix fallout.

Miscellanea:

o One of the conversions now uses %pR instead of multiple uses of %pad

Signed-off-by: Joe Perches 
---
 drivers/staging/ccree/ssi_aead.c|  8 
 drivers/staging/ccree/ssi_buffer_mgr.c  | 29 +
 drivers/staging/ccree/ssi_cipher.c  | 10 +-
 drivers/staging/ccree/ssi_driver.c  |  5 ++---
 drivers/staging/ccree/ssi_driver.h  |  2 +-
 drivers/staging/ccree/ssi_hash.c| 32 
 drivers/staging/ccree/ssi_request_mgr.c |  6 +++---
 7 files changed, 44 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index ea29b8a1a71d..9376bf8b8c61 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -103,7 +103,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
if (ctx->enckey) {
dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, 
ctx->enckey_dma_addr);
SSI_LOG_DEBUG("Freed enckey DMA buffer enckey_dma_addr=%pad\n",
- ctx->enckey_dma_addr);
+ >enckey_dma_addr);
ctx->enckey_dma_addr = 0;
ctx->enckey = NULL;
}
@@ -117,7 +117,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
  xcbc->xcbc_keys_dma_addr);
}
SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer 
xcbc_keys_dma_addr=%pad\n",
- xcbc->xcbc_keys_dma_addr);
+ >xcbc_keys_dma_addr);
xcbc->xcbc_keys_dma_addr = 0;
xcbc->xcbc_keys = NULL;
} else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */
@@ -128,7 +128,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
  hmac->ipad_opad,
  hmac->ipad_opad_dma_addr);
SSI_LOG_DEBUG("Freed ipad_opad DMA buffer 
ipad_opad_dma_addr=%pad\n",
- hmac->ipad_opad_dma_addr);
+ >ipad_opad_dma_addr);
hmac->ipad_opad_dma_addr = 0;
hmac->ipad_opad = NULL;
}
@@ -137,7 +137,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
  hmac->padded_authkey,
  hmac->padded_authkey_dma_addr);
SSI_LOG_DEBUG("Freed padded_authkey DMA buffer 
padded_authkey_dma_addr=%pad\n",
- hmac->padded_authkey_dma_addr);
+ >padded_authkey_dma_addr);
hmac->padded_authkey_dma_addr = 0;
hmac->padded_authkey = NULL;
}
diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index 6579a54f9dc4..e13184d1d165 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -14,6 +14,7 @@
  * along with this program; if not, see .
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -33,14 +34,10 @@
 #include "ssi_hash.h"
 #include "ssi_aead.h"
 
-#ifdef CC_DEBUG
 #define GET_DMA_BUFFER_TYPE(buff_type) ( \
((buff_type) == SSI_DMA_BUF_NULL) ? "BUF_NULL" : \
((buff_type) == SSI_DMA_BUF_DLLI) ? "BUF_DLLI" : \
((buff_type) == SSI_DMA_BUF_MLLI) ? "BUF_MLLI" : "BUF_INVALID")
-#else
-#define GET_DMA_BUFFER_TYPE(buff_type)
-#endif
 
 enum dma_buffer_type {
DMA_NULL_TYPE = -1,
@@ -262,7 +259,7 @@ static int ssi_buffer_mgr_generate_mlli(
SSI_LOG_DEBUG("MLLI params: "
 "virt_addr=%pK dma_addr=%pad mlli_len=0x%X\n",
   mlli_params->mlli_virt_addr,
-  mlli_params->mlli_dma_addr,
+  _params->mlli_dma_addr,
   mlli_params->mlli_len);
 
 build_mlli_exit:
@@ -278,7 +275,7 @@ static inline void ssi_buffer_mgr_add_buffer_entry(
 
SSI_LOG_DEBUG("index=%u single_buff=%pad "
 "buffer_len=0x%08X is_last=%d\n",
-index, buffer_dma, buffer_len, is_last_entry);
+index, _dma, buffer_len, is_last_entry);
sgl_data->nents[index] = 1;
sgl_data->entry[index].buffer_dma = buffer_dma;
sgl_data->offset[index] = 0;
@@ -362,7 +359,7 @@ static int ssi_buffer_mgr_map_scatterlist(
SSI_LOG_DEBUG("Mapped sg: dma_address=%pad "
 "page=%p addr=%pK offset=%u "
 "length=%u\n",
-sg_dma_address(sg),
+