Skip to content

Commit e045907

Browse files
Julia Lawallgregkh
authored andcommitted
drivers/char/tlclk.c: fix error return code
Convert a 0 error return code to a negative one, as returned elsewhere in the function. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @@ identifier ret; expression e,e1,e2,e3,e4,x; @@ ( if (\(ret != 0\|ret < 0\) || ...) { ... return ...; } | ret = 0 ) ... when != ret = e1 *x = \(kmalloc\|kzalloc\|kcalloc\|devm_kzalloc\|ioremap\|ioremap_nocache\|devm_ioremap\|devm_ioremap_nocache\)(...); ... when != x = e2 when != ret = e3 *if (x == NULL || ...) { ... when != ret = e4 * return ret; } // </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Acked-by: Mark Gross <mark.gross@intel.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d2323cf commit e045907

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎drivers/char/tlclk.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,10 @@ static int __init tlclk_init(void)
784784
}
785785
tlclk_major = ret;
786786
alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL);
787-
if (!alarm_events)
787+
if (!alarm_events) {
788+
ret = -ENOMEM;
788789
goto out1;
790+
}
789791

790792
/* Read telecom clock IRQ number (Set by BIOS) */
791793
if (!request_region(TLCLK_BASE, 8, "telco_clock")) {

0 commit comments

Comments
 (0)