[PATCH net-next] octeontx2-af: Fix error code in rvu_mbox_init()

Dan Carpenter posted 1 patch 3 months, 2 weeks ago
drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[PATCH net-next] octeontx2-af: Fix error code in rvu_mbox_init()
Posted by Dan Carpenter 3 months, 2 weeks ago
The error code was intended to be -EINVAL here, but it was accidentally
changed to returning success.  Set the error code.

Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index 7e538ee8a59f..c6bb3aaa8e0d 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -2458,9 +2458,9 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
 			 void (mbox_handler)(struct work_struct *),
 			 void (mbox_up_handler)(struct work_struct *))
 {
-	int err = -EINVAL, i, dir, dir_up;
 	void __iomem **mbox_regions;
 	struct ng_rvu *ng_rvu_mbox;
+	int err, i, dir, dir_up;
 	void __iomem *reg_base;
 	struct rvu_work *mwork;
 	unsigned long *pf_bmap;
@@ -2526,6 +2526,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
 			goto free_regions;
 		break;
 	default:
+		err = -EINVAL;
 		goto free_regions;
 	}
 
-- 
2.47.2
Re: [PATCH net-next] octeontx2-af: Fix error code in rvu_mbox_init()
Posted by Subbaraya Sundeep 3 months, 2 weeks ago
On 2025-06-25 at 15:23:05, Dan Carpenter (dan.carpenter@linaro.org) wrote:
> The error code was intended to be -EINVAL here, but it was accidentally
> changed to returning success.  Set the error code.
> 
> Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

 Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>

 Thanks for the patch. This has been pointed by Simon earlier:
 https://lore.kernel.org/all/20250618194301.GA1699@horms.kernel.org/

 Thanks,
 Sundeep

> ---
>  drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
> index 7e538ee8a59f..c6bb3aaa8e0d 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
> @@ -2458,9 +2458,9 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
>  			 void (mbox_handler)(struct work_struct *),
>  			 void (mbox_up_handler)(struct work_struct *))
>  {
> -	int err = -EINVAL, i, dir, dir_up;
>  	void __iomem **mbox_regions;
>  	struct ng_rvu *ng_rvu_mbox;
> +	int err, i, dir, dir_up;
>  	void __iomem *reg_base;
>  	struct rvu_work *mwork;
>  	unsigned long *pf_bmap;
> @@ -2526,6 +2526,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw,
>  			goto free_regions;
>  		break;
>  	default:
> +		err = -EINVAL;
>  		goto free_regions;
>  	}
>  
> -- 
> 2.47.2
>
Re: [PATCH net-next] octeontx2-af: Fix error code in rvu_mbox_init()
Posted by Simon Horman 3 months, 2 weeks ago
On Thu, Jun 26, 2025 at 06:34:23AM +0000, Subbaraya Sundeep wrote:
> On 2025-06-25 at 15:23:05, Dan Carpenter (dan.carpenter@linaro.org) wrote:
> > The error code was intended to be -EINVAL here, but it was accidentally
> > changed to returning success.  Set the error code.
> > 
> > Fixes: e53ee4acb220 ("octeontx2-af: CN20k basic mbox operations and structures")
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
>  Reviewed-by: Subbaraya Sundeep <sbhatta@marvell.com>
> 
>  Thanks for the patch. This has been pointed by Simon earlier:
>  https://lore.kernel.org/all/20250618194301.GA1699@horms.kernel.org/

Thanks for the fix.

Reviewed-by: Simon Horman <horms@kernel.org>