Skip to content

Commit

Permalink
drivers/rtc/rtc-r9701.c: avoid second call to rtc_valid_tm()
Browse files Browse the repository at this point in the history
r9701_get_datetime() calls rtc_valid_tm() and returns the value returned
by rtc_valid_tm(), which can be used in the `if', so calling
rtc_valid_tm() a second time is not required.

Signed-off-by: Devendra Naga <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Anatolij Gustschin <[email protected]>
Cc: Andreas Dumberger <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Devendra Naga authored and torvalds committed Jul 31, 2012
1 parent 064407f commit aa11ec5
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/rtc/rtc-r9701.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ static int __devinit r9701_probe(struct spi_device *spi)
* contain invalid values. If so, try to write a default date:
* 2000/1/1 00:00:00
*/
r9701_get_datetime(&spi->dev, &dt);
if (rtc_valid_tm(&dt)) {
if (r9701_get_datetime(&spi->dev, &dt)) {
dev_info(&spi->dev, "trying to repair invalid date/time\n");
dt.tm_sec = 0;
dt.tm_min = 0;
Expand Down

0 comments on commit aa11ec5

Please sign in to comment.