On Sat, May 16, 2020 at 10:35:33PM +0530, Lokesh Vutla wrote:
> Hi Richard,
> 
> On 16/05/20 10:24 PM, Richard Cochran wrote:
> > On Fri, Apr 17, 2020 at 10:00:09AM +0530, Lokesh Vutla wrote:
> >>  phc2pwm.c | 233 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >>  2 files changed, 237 insertions(+), 2 deletions(-)
> >>  create mode 100644 phc2pwm.c
> > 
> > I wanted to try this today.  There are some issues:
> > 
> > /home/richard/git/linuxptp/phc2pwm.c: In function ‘main’:
> > /home/richard/git/linuxptp/phc2pwm.c:222:3: error: ‘period’ may be used 
> > uninitialized in this function [-Werror=maybe-uninitialized]
> >    pwm_chan_set_period(chan, pwm_servo_sample(&ps, ts));
> >    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/richard/git/linuxptp/phc2pwm.c:193:8: error: ‘ptp_dev’ may be used 
> > uninitialized in this function [-Werror=maybe-uninitialized]
> >   clkid = phc_open(ptp_dev);
> >   ~~~~~~^~~~~~~~~~~~~~~~~~~
> > /home/richard/git/linuxptp/phc2pwm.c:203:8: error: ‘event_index’ may be 
> > used uninitialized in this function [-Werror=maybe-uninitialized]
> >   err = phc_enable_extts(clkid, event_index);
> >         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/richard/git/linuxptp/phc2pwm.c:197:9: error: ‘pwm_chan’ may be used 
> > uninitialized in this function [-Werror=maybe-uninitialized]
> >   chan = pwm_chan_create(pwm_chip, pwm_chan);
> >          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /home/richard/git/linuxptp/phc2pwm.c:197:9: error: ‘pwm_chip’ may be used 
> > uninitialized in this function [-Werror=maybe-uninitialized]
> > cc1: all warnings being treated as errors
> 
> I am using 9.2 arm compiler and the build is successful. Which compiler are 
> you
> using?

gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabihf

Compile with -Werror please.

The above warnings are in fact real bugs!

Thanks,
Richard


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to