[dpdk-dev,01/13] crypto: replace rte_panic instances in crypto driver

Message ID 1522841257-11826-2-git-send-email-arnon@qwilt.com (mailing list archive)
State Superseded, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Arnon Warshavsky April 4, 2018, 11:27 a.m. UTC
  Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
---
 drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 +++++---
 drivers/crypto/dpaa_sec/dpaa_sec.c          | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
  

Comments

Bruce Richardson April 4, 2018, 1:10 p.m. UTC | #1
On Wed, Apr 04, 2018 at 02:27:25PM +0300, Arnon Warshavsky wrote:
> Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
> ---
>  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 +++++---
>  drivers/crypto/dpaa_sec/dpaa_sec.c          | 8 +++++---
>  2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> index 784b96d..37a5727 100644
> --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> @@ -2861,9 +2861,11 @@ struct rte_security_ops dpaa2_sec_security_ops = {
>  					RTE_CACHE_LINE_SIZE,
>  					rte_socket_id());
>  
> -		if (cryptodev->data->dev_private == NULL)
> -			rte_panic("Cannot allocate memzone for private "
> -				  "device data");
> +		if (cryptodev->data->dev_private == NULL) {
> +			RTE_LOG(ERR, PMD, "%s() Cannot allocate memzone for "
> +					"private device data", __func__);
> +			return -1;
> +		}
>  	}
This is the right change to make, but can you please avoid wrapping literal
strings across lines. It means that the error message cannot be grepped.
Just put the __func__ on the second line.

Checkpatch and similar tools should ignore long lines if the long line is
simply caused by a literal string.

/Bruce
  
Arnon Warshavsky April 4, 2018, 8:43 p.m. UTC | #2
Cool.I assumed worst than needed when the checkpatches lady was not
satisfied.
Will fix that.

On Wed, Apr 4, 2018 at 4:10 PM, Bruce Richardson <bruce.richardson@intel.com
> wrote:

> On Wed, Apr 04, 2018 at 02:27:25PM +0300, Arnon Warshavsky wrote:
> > Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
> > ---
> >  drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 8 +++++---
> >  drivers/crypto/dpaa_sec/dpaa_sec.c          | 8 +++++---
> >  2 files changed, 10 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > index 784b96d..37a5727 100644
> > --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
> > @@ -2861,9 +2861,11 @@ struct rte_security_ops dpaa2_sec_security_ops = {
> >                                       RTE_CACHE_LINE_SIZE,
> >                                       rte_socket_id());
> >
> > -             if (cryptodev->data->dev_private == NULL)
> > -                     rte_panic("Cannot allocate memzone for private "
> > -                               "device data");
> > +             if (cryptodev->data->dev_private == NULL) {
> > +                     RTE_LOG(ERR, PMD, "%s() Cannot allocate memzone
> for "
> > +                                     "private device data", __func__);
> > +                     return -1;
> > +             }
> >       }
> This is the right change to make, but can you please avoid wrapping literal
> strings across lines. It means that the error message cannot be grepped.
> Just put the __func__ on the second line.
>
> Checkpatch and similar tools should ignore long lines if the long line is
> simply caused by a literal string.
>
> /Bruce
>
  

Patch

diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 784b96d..37a5727 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -2861,9 +2861,11 @@  struct rte_security_ops dpaa2_sec_security_ops = {
 					RTE_CACHE_LINE_SIZE,
 					rte_socket_id());
 
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private "
-				  "device data");
+		if (cryptodev->data->dev_private == NULL) {
+			RTE_LOG(ERR, PMD, "%s() Cannot allocate memzone for "
+					"private device data", __func__);
+			return -1;
+		}
 	}
 
 	dpaa2_dev->cryptodev = cryptodev;
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index c5191ce..3b22d8a 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -2374,9 +2374,11 @@  struct rte_security_ops dpaa_sec_security_ops = {
 					RTE_CACHE_LINE_SIZE,
 					rte_socket_id());
 
-		if (cryptodev->data->dev_private == NULL)
-			rte_panic("Cannot allocate memzone for private "
-					"device data");
+		if (cryptodev->data->dev_private == NULL) {
+			RTE_LOG(ERR, PMD, "%s() Cannot allocate memzone for private "
+					"device data", __func__);
+			return -1;
+		}
 	}
 
 	dpaa_dev->crypto_dev = cryptodev;