rtc: v3020: fix v3020_mmio_read_bit()
commit4549526e54461f6be8b229703d3c9488da1eb131
authorScott Valentine <svalentine@concentris-systems.com>
Wed, 11 Nov 2009 22:26:49 +0000 (11 14:26 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 8 Dec 2009 18:21:19 +0000 (8 10:21 -0800)
treebc8dec8f7ff1615df4ba6d38f69830f72ff3582a
parent073493a20768a109ed1e6e744a2fe88e8bbd2fab
rtc: v3020: fix v3020_mmio_read_bit()

commit bcb3a1676b87effbdeffe8da5c44f63433d158d9 upstream.

v3020_mmio_read_bit() always returns 0 when left_shift > 7.

v3020_mmio_read_bit()'s return type is (unsigned char).  The code returns
a value masked by (1 << left_shift) that is casted to the return type.  If
left_shift is larger than 7, the cast will always result in a 0 return
value.  The problem was discovered with left_shift = 16, and the included
patch corrects the problem.

The bug was introduced in the last (Apr 3 2009) commit of the file, kernel
versions 2.6.30 and later.

Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Paul Gortmaker <p_gortmaker@yahoo.com>
Cc: Raphael Assenat <raph@8d.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/rtc/rtc-v3020.c