Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2534175yba; Mon, 6 May 2019 07:37:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqz13HddIIaIyn6QT6ZaTEqo1HRmPLPyoVBwDzTx2VJ68/9cEiVoXpJF5YxVqPoK4hK/fly3 X-Received: by 2002:a63:6b49:: with SMTP id g70mr32405792pgc.176.1557153454241; Mon, 06 May 2019 07:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153454; cv=none; d=google.com; s=arc-20160816; b=i4u9ztpg82CtMk/WQ02M88v5qD+m0VscTRsYlnPdYSnfrX1YWDzz6BiEKZrDanvUtS zpoA38ENEkqWokNPOHoTmM5Ze/IJF8Olo1nVaacl8P92c6R8IXD1N/8cV5z8GfBWpWR/ 27fSsOvRWY6x12fFT3C+A/3/eqbzjBWVl4JceYiRnJZEv6i4Qi3m3cJxdmSwqcRlB57R PGWSsRR5livv/rUOcjLbY/71g2VE/AwPM2Zq7m/wR8bvpBqscGTsY+PFixtYpEiXHJML N9onWlY4fB5gRUcaHogHx6X3Gu4ZjGHoF0Qlcm39TVrQEnsBTfHGR6mf11nZv0AUBjh/ Gaiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=dKm4OTqF63RVPDW0Yali/Y4rq220+8ujdYdIkiPSMxk=; b=YiZIYVSKlqO4jggrAnQwQPhk6+uepqIPxGM3PwyFU9r6Vu9FEhyN0ozSO9RQC2KnZa nVAoXkxWaajeHazs7JZyQyJ8AHBJSc01Nj+Bgn2eLAPeaQGZZHzPqNpw5aeBUi1u+xE/ DG0CvvD46iSEMUJu0ue2HYKe39J6Ce/YXczdf/HMZA3hi6G9YnFEpf0xgHf3exL6EU/D B3dEnncRHyA20t9nWLiFOO2iHEFlgfOIinMT2NFmWhJn+tjaANsKXXNFaxQcb1kl9P0/ ts3qN1RlUfGYkwPTo1ebeFBsvN4O55s5j5UhhltglyICGiphZdncFgdV0UwLTTr508R/ DjYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XO3bqW3d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si16130544pls.222.2019.05.06.07.37.16; Mon, 06 May 2019 07:37:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XO3bqW3d; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726727AbfEFOel (ORCPT + 99 others); Mon, 6 May 2019 10:34:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:54432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726714AbfEFOek (ORCPT ); Mon, 6 May 2019 10:34:40 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 67DE42087F; Mon, 6 May 2019 14:34:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153279; bh=5Wpg1agI8//aA/QefpiJ/R9ESJljWz2kdcAj1ftvmkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XO3bqW3dPWpWs8/+9/dNQ1YyebpT5pjyQFtQwgdIM3rBtl3CRxFPK66hnLo99LWVu dEeUt7Oy2pAwmAhFt4a2V+Ta9oYeT2Ou4HGT4hTp5sIe0QBSnTFAXTkMRMAbYalJJI FfPiLlmqDAiA9blP98KPG8DQhDUiqGqExr/C0GVs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Alexandre Belloni , "Sasha Levin (Microsoft)" Subject: [PATCH 5.0 030/122] rtc: sh: Fix invalid alarm warning for non-enabled alarm Date: Mon, 6 May 2019 16:31:28 +0200 Message-Id: <20190506143057.500954018@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 (Microsoft) --- 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 d417b203cbc5..1d3de2a3d1a4 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c @@ -374,7 +374,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.20.1