[dpdk-dev,2/2] drivers/crypto: Fix anonymous union initialization in crypto

Message ID 1458890426-20688-3-git-send-email-michael.qiu@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Michael Qiu March 25, 2016, 7:20 a.m. UTC
  In SUSE11-SP3 i686 platform, with gcc 4.5.1, there is a
compile issue:
	null_crypto_pmd_ops.c:44:3: error:
		unknown field ‘sym’ specified in initializer
	cc1: warnings being treated as errors

The member in anonymous union initialization should be inside '{}',
otherwise it will report an error.

Fixes: 26c2e4ad5ad4 ("cryptodev: add capabilities discovery")

Signed-off-by: Michael Qiu <michael.qiu@intel.com>
---
 drivers/crypto/null/null_crypto_pmd_ops.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
  

Comments

Fiona Trahe March 25, 2016, 10:48 a.m. UTC | #1
> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Qiu

> Sent: Friday, March 25, 2016 7:20 AM

> To: dev@dpdk.org

> Cc: Qiu, Michael

> Subject: [dpdk-dev] [PATCH 2/2] drivers/crypto: Fix anonymous union

> initialization in crypto

> 

> In SUSE11-SP3 i686 platform, with gcc 4.5.1, there is a compile issue:

> 	null_crypto_pmd_ops.c:44:3: error:

> 		unknown field ‘sym’ specified in initializer

> 	cc1: warnings being treated as errors

> 

> The member in anonymous union initialization should be inside '{}', otherwise it

> will report an error.

> 

> Fixes: 26c2e4ad5ad4 ("cryptodev: add capabilities discovery")

> 

> Signed-off-by: Michael Qiu <michael.qiu@intel.com>



Initialisation in QAT PMD has same issue, possibly also other PMDs.
I'll extend this fix where needed.

> ---

>  drivers/crypto/null/null_crypto_pmd_ops.c | 16 ++++++++--------

>  1 file changed, 8 insertions(+), 8 deletions(-)

> 

> diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c

> b/drivers/crypto/null/null_crypto_pmd_ops.c

> index 39f8088..b7470c0 100644

> --- a/drivers/crypto/null/null_crypto_pmd_ops.c

> +++ b/drivers/crypto/null/null_crypto_pmd_ops.c

> @@ -41,9 +41,9 @@

>  static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] = {

>  	{	/* NULL (AUTH) */

>  		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,

> -		.sym = {

> +		{.sym = {

>  			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,

> -			.auth = {

> +			{.auth = {

>  				.algo = RTE_CRYPTO_AUTH_NULL,

>  				.block_size = 1,

>  				.key_size = {

> @@ -57,14 +57,14 @@ static const struct rte_cryptodev_capabilities

> null_crypto_pmd_capabilities[] =

>  					.increment = 0

>  				},

>  				.aad_size = { 0 }

> -			}

> -		}

> +			}, },

> +		}, },

>  	},

>  	{	/* NULL (CIPHER) */

>  		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,

> -		.sym = {

> +		{.sym = {

>  			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,

> -			.cipher = {

> +			{.cipher = {

>  				.algo = RTE_CRYPTO_CIPHER_NULL,

>  				.block_size = 1,

>  				.key_size = {

> @@ -77,8 +77,8 @@ static const struct rte_cryptodev_capabilities

> null_crypto_pmd_capabilities[] =

>  					.max = 0,

>  					.increment = 0

>  				}

> -			}

> -		}

> +			}, },

> +		}, },

>  	},

>  	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()

>  };

> --

> 1.9.3
  

Patch

diff --git a/drivers/crypto/null/null_crypto_pmd_ops.c b/drivers/crypto/null/null_crypto_pmd_ops.c
index 39f8088..b7470c0 100644
--- a/drivers/crypto/null/null_crypto_pmd_ops.c
+++ b/drivers/crypto/null/null_crypto_pmd_ops.c
@@ -41,9 +41,9 @@ 
 static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] = {
 	{	/* NULL (AUTH) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_AUTH,
-			.auth = {
+			{.auth = {
 				.algo = RTE_CRYPTO_AUTH_NULL,
 				.block_size = 1,
 				.key_size = {
@@ -57,14 +57,14 @@  static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =
 					.increment = 0
 				},
 				.aad_size = { 0 }
-			}
-		}
+			}, },
+		}, },
 	},
 	{	/* NULL (CIPHER) */
 		.op = RTE_CRYPTO_OP_TYPE_SYMMETRIC,
-		.sym = {
+		{.sym = {
 			.xform_type = RTE_CRYPTO_SYM_XFORM_CIPHER,
-			.cipher = {
+			{.cipher = {
 				.algo = RTE_CRYPTO_CIPHER_NULL,
 				.block_size = 1,
 				.key_size = {
@@ -77,8 +77,8 @@  static const struct rte_cryptodev_capabilities null_crypto_pmd_capabilities[] =
 					.max = 0,
 					.increment = 0
 				}
-			}
-		}
+			}, },
+		}, },
 	},
 	RTE_CRYPTODEV_END_OF_CAPABILITIES_LIST()
 };