Thread (13 messages) 13 messages, 2 authors, 2025-05-22

Re: [PATCH v9 net-next 5/8] net: ena: Add debugfs support to the ENA driver

From: Andrew Lunn <andrew@lunn.ch>
Date: 2025-05-22 12:30:10

On Thu, May 22, 2025 at 05:24:10AM +0000, Arinzon, David wrote:
quoted
quoted
+void ena_debugfs_init(struct net_device *dev) {
+     struct ena_adapter *adapter = netdev_priv(dev);
+
+     adapter->debugfs_base =
+             debugfs_create_dir(dev_name(&adapter->pdev->dev), NULL);
+     if (IS_ERR(adapter->debugfs_base))
+             netdev_err(dev, "Failed to create debugfs dir\n");
Don't check return codes from debugfs_ calls. It does not matter if it fails, it is
just debug, and all debugfs_ calls are happy to take a NULL pointer,
ERR_PTR() etc.

        Andrew
Thank you for the feedback.
We were looking to get a failure indication and not continue creating the rest of the nodes (patch 6/8).
That will automagically happen, because when you pass the ERR_PTR from
debugfs_create_dir() to other functions, they become NOPs.

If you look around, you will find bot drivers submitting patches
removing such checks, because they are not wanted nor needed.

	Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help