From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FA57C282E1 for ; Wed, 24 Apr 2019 14:58:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 54B4D218FE for ; Wed, 24 Apr 2019 14:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556117921; bh=UiO+nVIPhQ/eG1HaAS3VaFLNOkSdijG8J63yZzs1Lzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=x2fvPZpLiYgwYOrPzD2cbIJarF4fkxbVshgo1IWQ/fxYn+BV0NOUZ17LVW4VvXg7V GLeH652V4OK6LFPmXswBsll7N/Rhf03COjzeLcHfNwAWxcAXIOlZyqYga1hhvH1DWu CBgD0SPxC9kbBAra3V319fH1a12sRyK9kAiKuZVw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732577AbfDXOua (ORCPT ); Wed, 24 Apr 2019 10:50:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:49600 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732547AbfDXOuV (ORCPT ); Wed, 24 Apr 2019 10:50:21 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E305E218FC; Wed, 24 Apr 2019 14:50:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1556117420; bh=UiO+nVIPhQ/eG1HaAS3VaFLNOkSdijG8J63yZzs1Lzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iRpcGBOiXjzJQ7lg829o9pSjbfLbWOWIwFmPovrm2zkdB3RxN338O9b2O0jg/lliZ AFEMtPEy/EDd/8OmdPBYY1TBRJHALzx9WeszT4CSbrcklD+NzKShJsZwcmxrFyFzff 2ZJcEP43a5V/hT+j2OvicYKcji3WkDALOJEzazGs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Geert Uytterhoeven , Alexandre Belloni , Sasha Levin , linux-rtc@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 03/28] rtc: sh: Fix invalid alarm warning for non-enabled alarm Date: Wed, 24 Apr 2019 10:49:47 -0400 Message-Id: <20190424145012.30886-3-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190424145012.30886-1-sashal@kernel.org> References: <20190424145012.30886-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 15d82d22498784966df8e4696174a16b02cc1052 ] When no alarm has been programmed on RSK-RZA1, an error message is printed during boot: rtc rtc0: invalid alarm value: 2019-03-14T255:255:255 sh_rtc_read_alarm_value() returns 0xff when querying a hardware alarm field that is not enabled. __rtc_read_alarm() validates the received alarm values, and fills in missing fields when needed. While 0xff is handled fine for the year, month, and day fields, and corrected as considered being out-of-range, this is not the case for the hour, minute, and second fields, where -1 is expected for missing fields. Fix this by returning -1 instead, as this value is handled fine for all fields. Signed-off-by: Geert Uytterhoeven Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin --- drivers/rtc/rtc-sh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index 17b6235d67a5..600fb7f93939 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c @@ -454,7 +454,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm) static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off) { unsigned int byte; - int value = 0xff; /* return 0xff for ignored values */ + int value = -1; /* return -1 for ignored values */ byte = readb(rtc->regbase + reg_off); if (byte & AR_ENB) { -- 2.19.1