diff mbox series

[5.4,135/177] net: netcp: Fix an error message

Message ID 20210531130652.606363904@linuxfoundation.org
State Superseded
Headers show
Series None | expand

Commit Message

Greg KH May 31, 2021, 1:14 p.m. UTC
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

[ Upstream commit ddb6e00f8413e885ff826e32521cff7924661de0 ]

'ret' is known to be 0 here.
The expected error code is stored in 'tx_pipe->dma_queue', so use it
instead.

While at it, switch from %d to %pe which is more user friendly.

Fixes: 84640e27f230 ("net: netcp: Add Keystone NetCP core ethernet driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/net/ethernet/ti/netcp_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Christophe JAILLET May 31, 2021, 6:46 p.m. UTC | #1
Le 31/05/2021 à 15:14, Greg Kroah-Hartman a écrit :
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> [ Upstream commit ddb6e00f8413e885ff826e32521cff7924661de0 ]
>
> 'ret' is known to be 0 here.
> The expected error code is stored in 'tx_pipe->dma_queue', so use it
> instead.
>
> While at it, switch from %d to %pe which is more user friendly.
>
> Fixes: 84640e27f230 ("net: netcp: Add Keystone NetCP core ethernet driver")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>   drivers/net/ethernet/ti/netcp_core.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
> index 1b2702f74455..c0025bb8a584 100644
> --- a/drivers/net/ethernet/ti/netcp_core.c
> +++ b/drivers/net/ethernet/ti/netcp_core.c
> @@ -1350,8 +1350,8 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
>   	tx_pipe->dma_queue = knav_queue_open(name, tx_pipe->dma_queue_id,
>   					     KNAV_QUEUE_SHARED);
>   	if (IS_ERR(tx_pipe->dma_queue)) {
> -		dev_err(dev, "Could not open DMA queue for channel \"%s\": %d\n",
> -			name, ret);
> +		dev_err(dev, "Could not open DMA queue for channel \"%s\": %pe\n",
> +			name, tx_pipe->dma_queue);
>   		ret = PTR_ERR(tx_pipe->dma_queue);
>   		goto err;
>   	}


Hi,

Apparently %pe is only supported up to (including) 5.5. It is not part 
of 5.4.123.

So this patch should not be backported here or should be backported 
differently, ie:
    leave dev_err as-is
    move "ret = PTR_ERR(tx_pipe->dma_queue);" 1 line above

(or %pe should be backported first)


PS: adding Dan Carpenter because we had a small discussion about some 
potential backport issue when, using %pe

CJ
Sasha Levin May 31, 2021, 9:42 p.m. UTC | #2
On Mon, May 31, 2021 at 08:46:03PM +0200, Marion & Christophe JAILLET wrote:
>
>Le 31/05/2021 à 15:14, Greg Kroah-Hartman a écrit :
>>From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>
>>[ Upstream commit ddb6e00f8413e885ff826e32521cff7924661de0 ]
>>
>>'ret' is known to be 0 here.
>>The expected error code is stored in 'tx_pipe->dma_queue', so use it
>>instead.
>>
>>While at it, switch from %d to %pe which is more user friendly.
>>
>>Fixes: 84640e27f230 ("net: netcp: Add Keystone NetCP core ethernet driver")
>>Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>Signed-off-by: David S. Miller <davem@davemloft.net>
>>Signed-off-by: Sasha Levin <sashal@kernel.org>
>>---
>>  drivers/net/ethernet/ti/netcp_core.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>>diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
>>index 1b2702f74455..c0025bb8a584 100644
>>--- a/drivers/net/ethernet/ti/netcp_core.c
>>+++ b/drivers/net/ethernet/ti/netcp_core.c
>>@@ -1350,8 +1350,8 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
>>  	tx_pipe->dma_queue = knav_queue_open(name, tx_pipe->dma_queue_id,
>>  					     KNAV_QUEUE_SHARED);
>>  	if (IS_ERR(tx_pipe->dma_queue)) {
>>-		dev_err(dev, "Could not open DMA queue for channel \"%s\": %d\n",
>>-			name, ret);
>>+		dev_err(dev, "Could not open DMA queue for channel \"%s\": %pe\n",
>>+			name, tx_pipe->dma_queue);
>>  		ret = PTR_ERR(tx_pipe->dma_queue);
>>  		goto err;
>>  	}
>
>
>Hi,
>
>Apparently %pe is only supported up to (including) 5.5. It is not part 
>of 5.4.123.
>
>So this patch should not be backported here or should be backported 
>differently, ie:
>   leave dev_err as-is
>   move "ret = PTR_ERR(tx_pipe->dma_queue);" 1 line above

I'll fix it up the way you've described above. Thanks!
Dan Carpenter June 1, 2021, 7:08 a.m. UTC | #3
On Mon, May 31, 2021 at 05:42:28PM -0400, Sasha Levin wrote:
> > Hi,

> > 

> > Apparently %pe is only supported up to (including) 5.5. It is not part

> > of 5.4.123.

> > 


It seems like it would be easier to just back port the %pe commit to
v5.4?  It seems to apply and build basically fine?  I didn't try test
it.  It's commit 57f5677e535b ("printf: add support for printing
symbolic error names").

Rasmus, we were always wondering when you were going to make it work
for integer error codes.  ;)

regards,
dan carpenter
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 1b2702f74455..c0025bb8a584 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -1350,8 +1350,8 @@  int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
 	tx_pipe->dma_queue = knav_queue_open(name, tx_pipe->dma_queue_id,
 					     KNAV_QUEUE_SHARED);
 	if (IS_ERR(tx_pipe->dma_queue)) {
-		dev_err(dev, "Could not open DMA queue for channel \"%s\": %d\n",
-			name, ret);
+		dev_err(dev, "Could not open DMA queue for channel \"%s\": %pe\n",
+			name, tx_pipe->dma_queue);
 		ret = PTR_ERR(tx_pipe->dma_queue);
 		goto err;
 	}