[v5,3/3] eal: fix a wrong returned value when callback exists
Checks
Commit Message
From: Yunjian Wang <wangyunjian@huawei.com>
We should return an error value, when the callback is already exist.
Fixes: a753e53d517b ("eal: add device event monitor framework")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Suggested-by: David Marchand <david.marchand@6wind.com>
---
lib/librte_eal/common/eal_common_dev.c | 2 ++
1 file changed, 2 insertions(+)
Comments
On Wed, Oct 21, 2020 at 1:20 PM wangyunjian <wangyunjian@huawei.com> wrote:
>
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> We should return an error value, when the callback is already exist.
>
> Fixes: a753e53d517b ("eal: add device event monitor framework")
> Cc: stable@dpdk.org
Same question as for the previous patch, should we backport this?
> -----Original Message-----
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Thursday, October 22, 2020 8:55 PM
> To: wangyunjian <wangyunjian@huawei.com>
> Cc: dev <dev@dpdk.org>; Jeff Guo <jia.guo@intel.com>; Jerin Jacob
> Kollanukkaran <jerinj@marvell.com>; Lilijun (Jerry) <jerry.lilijun@huawei.com>;
> xudingke <xudingke@huawei.com>; dpdk stable <stable@dpdk.org>; Kevin
> Traynor <ktraynor@redhat.com>; Luca Boccassi <bluca@debian.org>
> Subject: Re: [dpdk-dev] [PATCH v5 3/3] eal: fix a wrong returned value when
> callback exists
>
> On Wed, Oct 21, 2020 at 1:20 PM wangyunjian <wangyunjian@huawei.com>
> wrote:
> >
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > We should return an error value, when the callback is already exist.
> >
> > Fixes: a753e53d517b ("eal: add device event monitor framework")
> > Cc: stable@dpdk.org
>
> Same question as for the previous patch, should we backport this?
Agree, not backport it.
Yunjian
>
>
> --
> David Marchand
@@ -480,7 +480,9 @@ rte_dev_event_callback_register(const char *device_name,
RTE_LOG(ERR, EAL,
"The callback is already exist, no need "
"to register again.\n");
+ event_cb = NULL;
ret = -EEXIST;
+ goto error;
}
rte_spinlock_unlock(&dev_event_lock);