net: return actual error on register_queue_kobjects [Linux 3.16]

This Linux kernel change "net: return actual error on register_queue_kobjects" is included in the Linux 3.16 release. This change is authored by Jie Liu <jeff.liu [at] oracle.com> on Tue Jun 17 22:32:42 2014 +0800. The commit for this change in Linux stable tree is d36a4f4 (patch).

net: return actual error on register_queue_kobjects

Return the actual error code if call kset_create_and_add() failed

Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Jie Liu <jeff.liu@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

There are 4 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/core/net-sysfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 1cac29e..5c1c1e5 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -1200,8 +1200,8 @@ static int register_queue_kobjects(struct net_device *net)
 #ifdef CONFIG_SYSFS
    net->queues_kset = kset_create_and_add("queues",
        NULL, &net->dev.kobj);
-   if (!net->queues_kset)
-       return -ENOMEM;
+   if (IS_ERR(net->queues_kset))
+       return PTR_ERR(net->queues_kset);
    real_rx = net->real_num_rx_queues;
 #endif
    real_tx = net->real_num_tx_queues;

Leave a Reply

Your email address will not be published. Required fields are marked *