lkml.org 
[lkml]   [2009]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rtc-linux] [PATCH 7/9] drivers/rtc: correct error-handling code
On Tue, Jul 28, 2009 at 05:55:33PM +0200, Julia Lawall wrote:
>
> From: Julia Lawall <julia@diku.dk>
>
> This code is not executed before ds1307->rtc has been successfully
> initialized to the result of calling rtc_device_register. Thus the test
> that ds1307->rtc is not NULL is always true.
>
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @match exists@
> expression x, E;
> statement S1, S2;
> @@
>
> x = rtc_device_register(...)
> ... when != x = E
> (
> * if (x == NULL || ...) S1 else S2
> |
> * if (x == NULL && ...) S1 else S2
> )
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>

Acked-by: Wolfram Sang <w.sang@pengutronix.de>

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2009-07-28 19:03    [W:3.947 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site