[v1] bus/fslmc: fix dpio close

Message ID 20200728162459.990-1-rohit.raj@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v1] bus/fslmc: fix dpio close |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Rohit Raj July 28, 2020, 4:24 p.m. UTC
  From: Rohit Raj <rohit.raj@nxp.com>

The current state of the DPIO object should be checked
before trying to close/disable the object.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
  

Comments

Sachin Saxena (OSS) Aug. 6, 2020, 2:32 p.m. UTC | #1
Acked-by: Sachin Saxena<sachin.saxena@oss.nxp.com>


On 28-Jul-20 9:54 PM, rohit.raj@nxp.com wrote:
> From: Rohit Raj <rohit.raj@nxp.com>
>
> The current state of the DPIO object should be checked
> before trying to close/disable the object.
>
> Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
> Cc: stable@dpdk.org
>
> Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
> ---
>   drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> index 97be76116..b0055b164 100644
> --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
> @@ -528,8 +528,13 @@ dpaa2_create_dpio_device(int vdev_fd,
>   
>   err:
>   	if (dpio_dev->dpio) {
> -		dpio_disable(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token);
> -		dpio_close(dpio_dev->dpio, CMD_PRI_LOW,  dpio_dev->token);
> +		if (dpio_dev->token) {
> +			dpio_disable(dpio_dev->dpio, CMD_PRI_LOW,
> +				     dpio_dev->token);
> +			dpio_close(dpio_dev->dpio, CMD_PRI_LOW,
> +				   dpio_dev->token);
> +		}
> +
>   		rte_free(dpio_dev->eqresp);
>   		rte_free(dpio_dev->dpio);
>   	}
  
Thomas Monjalon Oct. 6, 2020, 8:57 a.m. UTC | #2
06/08/2020 16:32, Sachin Saxena (OSS):
> On 28-Jul-20 9:54 PM, rohit.raj@nxp.com wrote:
> > From: Rohit Raj <rohit.raj@nxp.com>
> >
> > The current state of the DPIO object should be checked
> > before trying to close/disable the object.
> >
> > Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
> 
> Acked-by: Sachin Saxena <sachin.saxena@oss.nxp.com>

Applied, thanks
  

Patch

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
index 97be76116..b0055b164 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c
@@ -528,8 +528,13 @@  dpaa2_create_dpio_device(int vdev_fd,
 
 err:
 	if (dpio_dev->dpio) {
-		dpio_disable(dpio_dev->dpio, CMD_PRI_LOW, dpio_dev->token);
-		dpio_close(dpio_dev->dpio, CMD_PRI_LOW,  dpio_dev->token);
+		if (dpio_dev->token) {
+			dpio_disable(dpio_dev->dpio, CMD_PRI_LOW,
+				     dpio_dev->token);
+			dpio_close(dpio_dev->dpio, CMD_PRI_LOW,
+				   dpio_dev->token);
+		}
+
 		rte_free(dpio_dev->eqresp);
 		rte_free(dpio_dev->dpio);
 	}