From: Cong Wang <xiyou.wangcong@gmail.com>
To: netdev@vger.kernel.org
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Subject: [PATCH 13/13] net_sched: return NULL instead of ERR_PTR for qdisc_alloc()
Date: Tue, 4 Nov 2014 09:56:36 -0800 [thread overview]
Message-ID: <1415123796-8093-14-git-send-email-xiyou.wangcong@gmail.com> (raw)
In-Reply-To: <1415123796-8093-1-git-send-email-xiyou.wangcong@gmail.com>
It always returns ENOFBUFS so we can return NULL
and let its callers set this errno.
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
---
net/sched/sch_api.c | 4 ++--
net/sched/sch_generic.c | 5 ++---
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 38c42bd..27bfd75 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -905,8 +905,8 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
goto err_out;
sch = qdisc_alloc(dev_queue, ops);
- if (IS_ERR(sch)) {
- err = PTR_ERR(sch);
+ if (!sch) {
+ err = -ENOBUFS;
goto err_out2;
}
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 29db9c8..b474fbb 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -585,7 +585,6 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
void *p;
struct Qdisc *sch;
unsigned int size = QDISC_ALIGN(sizeof(*sch)) + ops->priv_size;
- int err = -ENOBUFS;
struct net_device *dev = dev_queue->dev;
p = kzalloc_node(size, GFP_KERNEL,
@@ -620,7 +619,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
return sch;
errout:
- return ERR_PTR(err);
+ return NULL;
}
struct Qdisc *qdisc_create_internal(struct netdev_queue *dev_queue,
@@ -633,7 +632,7 @@ struct Qdisc *qdisc_create_internal(struct netdev_queue *dev_queue,
goto errout;
sch = qdisc_alloc(dev_queue, ops);
- if (IS_ERR(sch))
+ if (!sch)
goto errout;
sch->parent = parentid;
--
1.8.3.1
next prev parent reply other threads:[~2014-11-04 17:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-04 17:56 [PATCH 00/13] net_sched: misc cleanups and improvements Cong Wang
2014-11-04 17:56 ` [PATCH 01/13] net_sched: refactor out tcf_exts Cong Wang
2014-11-04 17:56 ` [PATCH 02/13] net_sched: introduce qdisc_peek() helper function Cong Wang
2014-11-04 18:45 ` Stephen Hemminger
2014-11-05 1:05 ` Cong Wang
2014-11-05 3:49 ` Herbert Xu
2014-11-06 2:50 ` Cong Wang
2014-11-04 17:56 ` [PATCH 03/13] net_sched: rename ->gso_skb to ->dequeued_skb Cong Wang
2014-11-04 17:56 ` [PATCH 04/13] net_sched: rename qdisc_drop() to qdisc_drop_skb() Cong Wang
2014-11-04 17:56 ` [PATCH 05/13] net_sched: introduce qdisc_drop() helper function Cong Wang
2014-11-04 17:56 ` [PATCH 06/13] net_sched: move some qdisc flag into qdisc ops Cong Wang
2014-11-04 17:56 ` [PATCH 07/13] net_sched: move TCQ_F_MQROOT " Cong Wang
2014-11-04 17:56 ` [PATCH 08/13] net_sched: use a flag to indicate fifo qdiscs instead of the name Cong Wang
2014-11-04 17:56 ` [PATCH 09/13] net_sched: redefine qdisc_create_dflt() Cong Wang
2014-11-04 17:56 ` [PATCH 10/13] net_sched: forbid setting default qdisc to inappropriate ones Cong Wang
2014-11-04 17:56 ` [PATCH 11/13] net_sched: remove hashmask from Qdisc_class_hash Cong Wang
2014-11-04 17:56 ` [PATCH 12/13] net_sched: remove useless qdisc_stab_lock Cong Wang
2014-11-04 17:56 ` Cong Wang [this message]
2014-11-04 18:20 ` [PATCH 00/13] net_sched: misc cleanups and improvements Eric Dumazet
2014-11-04 19:56 ` David Miller
2014-11-05 1:25 ` Cong Wang
2014-11-05 1:47 ` Eric Dumazet
2014-11-06 18:05 ` Cong Wang
2014-11-06 18:17 ` Eric Dumazet
2014-11-06 19:03 ` David Miller
2014-11-06 18:21 ` Eric Dumazet
2014-11-06 19:02 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1415123796-8093-14-git-send-email-xiyou.wangcong@gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).