From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] eal_interrupts.c: properly init struct epoll_event (valgrind) Date: Thu, 17 Mar 2016 15:18:15 +0100 Message-ID: <1663421.MSGVGpLJHn@xps13> References: <1455345678-17662-1-git-send-email-mhall@mhcomputing.net> <20160214122209.38b0efb6@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org, Matthew Hall To: Stephen Hemminger Return-path: Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 45792B62 for ; Thu, 17 Mar 2016 15:19:45 +0100 (CET) Received: by mail-wm0-f47.google.com with SMTP id p65so119637240wmp.0 for ; Thu, 17 Mar 2016 07:19:45 -0700 (PDT) In-Reply-To: <20160214122209.38b0efb6@xeon-e3> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Stephen, Please, could you turn it into a real patch with your sign-off? Thanks 2016-02-14 12:22, Stephen Hemminger: > A better patch would be to move the data structure into the > code block used, and get rid of the useless else (rte_panic never returns); > and fix the indentation, and use C99 initialization which should make valgrind > happier. > > The moral is don't just slap memsets around > > diff --git a/lib/librte_eal/linuxapp/eal/eal_interrupts.c b/lib/librte_eal/linuxapp/eal/eal_interrupts.c > index 06b26a9..d53826e 100644 > --- a/lib/librte_eal/linuxapp/eal/eal_interrupts.c > +++ b/lib/librte_eal/linuxapp/eal/eal_interrupts.c > @@ -799,8 +799,6 @@ eal_intr_handle_interrupts(int pfd, unsigned totalfds) > static __attribute__((noreturn)) void * > eal_intr_thread_main(__rte_unused void *arg) > { > - struct epoll_event ev; > - > /* host thread, never break out */ > for (;;) { > /* build up the epoll fd with all descriptors we are to > @@ -834,20 +832,22 @@ eal_intr_thread_main(__rte_unused void *arg) > TAILQ_FOREACH(src, &intr_sources, next) { > if (src->callbacks.tqh_first == NULL) > continue; /* skip those with no callbacks */ > - ev.events = EPOLLIN | EPOLLPRI; > - ev.data.fd = src->intr_handle.fd; > + > + struct epoll_event ev = { > + .events = EPOLLIN | EPOLLPRI, > + .data.fd = src->intr_handle.fd, > + }; > > /** > * add all the uio device file descriptor > * into wait list. > */ > if (epoll_ctl(pfd, EPOLL_CTL_ADD, > - src->intr_handle.fd, &ev) < 0){ > + src->intr_handle.fd, &ev) < 0) > rte_panic("Error adding fd %d epoll_ctl, %s\n", > src->intr_handle.fd, strerror(errno)); > - } > - else > - numfds++; > + > + numfds++; > } > rte_spinlock_unlock(&intr_lock); > /* serve the interrupt */