@@ -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;
}
@@ -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;
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(-)