diff mbox series

[net-next,1/3] net: xilinx: axienet: Use NL_SET_ERR_MSG instead of netdev_err

Message ID 20240610231022.2460953-2-sean.anderson@linux.dev (mailing list archive)
State New, archived
Headers show
Series net: xilinx: axienet: Add statistics support | expand

Commit Message

Sean Anderson June 10, 2024, 11:10 p.m. UTC
This error message can be triggered by userspace. Use NL_SET_ERR_MSG so
the message is returned to the user and to avoid polluting the kernel
logs.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
---

 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Andrew Lunn June 10, 2024, 11:49 p.m. UTC | #1
On Mon, Jun 10, 2024 at 07:10:20PM -0400, Sean Anderson wrote:
> This error message can be triggered by userspace. Use NL_SET_ERR_MSG so
> the message is returned to the user and to avoid polluting the kernel
> logs.

This has nothing to do with statistics. So it would be better to post
it as a standalone patch. It is the sort of trivial patch that should
get merged quickly.

I would also comment about the change from EFAULT to EBUSY in the
commit message.

    Andrew

---
pw-bot: cr
Sean Anderson June 11, 2024, 3:06 p.m. UTC | #2
On 6/10/24 19:49, Andrew Lunn wrote:
> On Mon, Jun 10, 2024 at 07:10:20PM -0400, Sean Anderson wrote:
>> This error message can be triggered by userspace. Use NL_SET_ERR_MSG so
>> the message is returned to the user and to avoid polluting the kernel
>> logs.
> 
> This has nothing to do with statistics. So it would be better to post
> it as a standalone patch. It is the sort of trivial patch that should
> get merged quickly.

I included it in the series since patch 3 touches lines near it. But
upon reviewing that patch, it seems that these lines are not in that
patch's context. So I will resumbit this separately.

> I would also comment about the change from EFAULT to EBUSY in the
> commit message.

OK.

--Sean
diff mbox series

Patch

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index c29809cd9201..5f98daa5b341 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1945,9 +1945,9 @@  axienet_ethtools_set_coalesce(struct net_device *ndev,
 	struct axienet_local *lp = netdev_priv(ndev);
 
 	if (netif_running(ndev)) {
-		netdev_err(ndev,
-			   "Please stop netif before applying configuration\n");
-		return -EFAULT;
+		NL_SET_ERR_MSG(extack,
+			       "Please stop netif before applying configuration");
+		return -EBUSY;
 	}
 
 	if (ecoalesce->rx_max_coalesced_frames)