2011-02-02 01:31:41

by john stultz

[permalink] [raw]
Subject: PPS build warning

Hey Rodolfo,
Just ran into the following:

drivers/pps/kapi.c: In function ‘pps_event’:
drivers/pps/kapi.c:196: warning: ‘ts_real.flags’ may be used uninitialized in this function

Looks like you don't set the flags value in timespec_to_pps_ktime when
you initialize the rest of the structure.

thanks
-john


2011-02-08 23:32:00

by Andrew Morton

[permalink] [raw]
Subject: Re: PPS build warning

(cc Alexander)

On Tue, 01 Feb 2011 17:31:33 -0800
john stultz <[email protected]> wrote:

> Hey Rodolfo,
> Just ran into the following:
>
> drivers/pps/kapi.c: In function 'pps_event':
> drivers/pps/kapi.c:196: warning: 'ts_real.flags' may be used uninitialized in this function
>
> Looks like you don't set the flags value in timespec_to_pps_ktime when
> you initialize the rest of the structure.
>

2011-02-25 14:12:19

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH 0/2] fix two minor PPS issues

These patches fix two minor issues in PPS. The first is reported in
this thread and the second I found myself.

Alexander Gordeev (2):
pps: initialize ts_real properly
pps: remove unreachable code

drivers/pps/generators/pps_gen_parport.c | 5 -----
drivers/pps/kapi.c | 2 +-
2 files changed, 1 insertions(+), 6 deletions(-)

--
1.7.2.3

2011-02-25 14:12:08

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH 2/2] pps: remove unreachable code

Remove code enabled only when CONFIG_PREEMPT_RT is turned on because it
is not used in the vanilla kernel.

Signed-off-by: Alexander Gordeev <[email protected]>
---
drivers/pps/generators/pps_gen_parport.c | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/drivers/pps/generators/pps_gen_parport.c b/drivers/pps/generators/pps_gen_parport.c
index b93af3e..dcd39fb 100644
--- a/drivers/pps/generators/pps_gen_parport.c
+++ b/drivers/pps/generators/pps_gen_parport.c
@@ -216,11 +216,6 @@ static void parport_attach(struct parport *port)

hrtimer_init(&device.timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
device.timer.function = hrtimer_event;
-#ifdef CONFIG_PREEMPT_RT
- /* hrtimer interrupt will run in the interrupt context with this */
- device.timer.irqsafe = 1;
-#endif
-
hrtimer_start(&device.timer, next_intr_time(&device), HRTIMER_MODE_ABS);

return;
--
1.7.2.3

2011-02-25 14:12:11

by Alexander Gordeev

[permalink] [raw]
Subject: [PATCH 1/2] pps: initialize ts_real properly

Initialize ts_real.flags to fix compiler warning about possible
uninitialized use of this field.

Signed-off-by: Alexander Gordeev <[email protected]>
---
drivers/pps/kapi.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pps/kapi.c b/drivers/pps/kapi.c
index cba1b43..a4e8eb9 100644
--- a/drivers/pps/kapi.c
+++ b/drivers/pps/kapi.c
@@ -168,7 +168,7 @@ void pps_event(struct pps_device *pps, struct pps_event_time *ts, int event,
{
unsigned long flags;
int captured = 0;
- struct pps_ktime ts_real;
+ struct pps_ktime ts_real = { .sec = 0, .nsec = 0, .flags = 0 };

/* check event type */
BUG_ON((event & (PPS_CAPTUREASSERT | PPS_CAPTURECLEAR)) == 0);
--
1.7.2.3