On Sun, Jan 10, 2010 at 06:33:37PM +0100, Krzysztof Halasa wrote:
> Signed-off-by: Krzysztof HaƂasa <k...@pm.waw.pl>
> 
> diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
> index 0c7e4f5..f8f6515 100644
> --- a/drivers/crypto/ixp4xx_crypto.c
> +++ b/drivers/crypto/ixp4xx_crypto.c
> @@ -64,7 +64,7 @@
>  
>  #define MOD_DES     0x0000
>  #define MOD_TDEA2   0x0100
> -#define MOD_3DES   0x0200
> +#define MOD_3DES    0x0200
>  #define MOD_AES     0x0800
>  #define MOD_AES128  (0x0800 | KEYLEN_128)
>  #define MOD_AES192  (0x0900 | KEYLEN_192)
> @@ -137,7 +137,7 @@ struct crypt_ctl {
>       u32 aadAddr;            /* Additional Auth Data Addr for CCM mode */
>       u32 crypto_ctx;         /* NPE Crypto Param structure address */
>  
> -     /* Used by Host: 4*4 bytes*/
> +     /* Used only by host: 4 * 4 bytes */
>       unsigned ctl_flags;
>       union {
>               struct ablkcipher_request *ablk_req;
> @@ -208,10 +208,10 @@ static const struct ix_hash_algo hash_alg_sha1 = {
>  };
>  
>  static struct npe *npe_c;
> -static struct dma_pool *buffer_pool = NULL;
> -static struct dma_pool *ctx_pool = NULL;
> +static struct dma_pool *buffer_pool;
> +static struct dma_pool *ctx_pool;
>  
> -static struct crypt_ctl *crypt_virt = NULL;
> +static struct crypt_ctl *crypt_virt;

This is not a whitespace-fix.
The error-path in init_ixp_crypto() depends on them being either NULL
or correctly allocated.

Or is it guaranteed that static variables are always initially zero ?

>  static dma_addr_t crypt_phys;
>  
>  static int support_aes = 1;

But this initialization is superflous, since it will be initialized before use.

> @@ -246,12 +246,12 @@ static inline struct crypt_ctl 
> *crypt_phys2virt(dma_addr_t phys)
>  
>  static inline u32 cipher_cfg_enc(struct crypto_tfm *tfm)
>  {
> -     return container_of(tfm->__crt_alg, struct ixp_alg,crypto)->cfg_enc;
> +     return container_of(tfm->__crt_alg, struct ixp_alg, crypto)->cfg_enc;
>  }
>  
>  static inline u32 cipher_cfg_dec(struct crypto_tfm *tfm)
>  {
> -     return container_of(tfm->__crt_alg, struct ixp_alg,crypto)->cfg_dec;
> +     return container_of(tfm->__crt_alg, struct ixp_alg, crypto)->cfg_dec;
>  }
>  
>  static inline const struct ix_hash_algo *ix_hash(struct crypto_tfm *tfm)
> @@ -275,7 +275,7 @@ static spinlock_t desc_lock;
>  static struct crypt_ctl *get_crypt_desc(void)
>  {
>       int i;
> -     static int idx = 0;
> +     static int idx;

This static index must be initialized with 0.

>       unsigned long flags;
>       struct crypt_ctl *desc = NULL;
>  
> @@ -318,13 +318,13 @@ static struct crypt_ctl *get_crypt_desc_emerg(void)
>               if (++idx >= NPE_QLEN_TOTAL)
>                       idx = NPE_QLEN;
>               crypt_virt[i].ctl_flags = CTL_FLAG_USED;
> -             desc = crypt_virt +i;
> +             desc = crypt_virt + i;
>       }
>       spin_unlock_irqrestore(&emerg_lock, flags);
>       return desc;
>  }
>  
> -static void free_buf_chain(struct device *dev, struct buffer_desc *buf,u32 
> phys)
> +static void free_buf_chain(struct device *dev, struct buffer_desc *buf, u32 
> phys)

Introduces a line-length > 80.

>  {
>       while (buf) {
>               struct buffer_desc *buf1;
> @@ -349,10 +349,9 @@ static void finish_scattered_hmac(struct crypt_ctl 
> *crypt)
>       int authsize = crypto_aead_authsize(tfm);

[ snip ]

> @@ -1416,7 +1393,7 @@ static struct ixp_alg ixp4xx_algos[] = {
>  static int __init ixp_module_init(void)
>  {
>       int num = ARRAY_SIZE(ixp4xx_algos);
> -     int i,err ;
> +     int i, err ;

Missed one before the ;

>  
>       if (platform_device_register(&pseudo_dev))
>               return -ENODEV;
> @@ -1429,18 +1406,14 @@ static int __init ixp_module_init(void)
>               platform_device_unregister(&pseudo_dev);
>               return err;
>       }
> -     for (i=0; i< num; i++) {
> +     for (i = 0; i < num; i++) {
>               struct crypto_alg *cra = &ixp4xx_algos[i].crypto;
>  
>               if (snprintf(cra->cra_driver_name, CRYPTO_MAX_ALG_NAME,
> -                     "%s"IXP_POSTFIX, cra->cra_name) >=
> -                     CRYPTO_MAX_ALG_NAME)
> -             {
> +                     "%s"IXP_POSTFIX, cra->cra_name) >= CRYPTO_MAX_ALG_NAME)
>                       continue;
> -             }
> -             if (!support_aes && (ixp4xx_algos[i].cfg_enc & MOD_AES)) {
> +             if (!support_aes && (ixp4xx_algos[i].cfg_enc & MOD_AES))
>                       continue;
> -             }
>               if (!ixp4xx_algos[i].hash) {
>                       /* block ciphers */
>                       cra->cra_type = &crypto_ablkcipher_type;
> @@ -1484,7 +1457,7 @@ static void __exit ixp_module_exit(void)
>       int num = ARRAY_SIZE(ixp4xx_algos);
>       int i;
>  
> -     for (i=0; i< num; i++) {
> +     for (i = 0; i < num; i++) {
>               if (ixp4xx_algos[i].registered)
>                       crypto_unregister_alg(&ixp4xx_algos[i].crypto);
>       }

Christian Hohnstaedt

-- 
Christian Hohnstaedt / Project Manager Hardware and Manufacturing

Innominate Security Technologies AG / protecting industrial networks
tel: +49.30.921028.208 / fax: +49.30.921028.020
Rudower Chaussee 13, D-12489 Berlin / http://www.innominate.com

Register Court: AG Charlottenburg, HR B 81603
Management Board: Dirk Seewald
Chairman of the Supervisory Board: Volker Bibelhausen
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to