Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1947921ybv; Fri, 14 Feb 2020 08:42:21 -0800 (PST) X-Google-Smtp-Source: APXvYqw7aDKyb0RQAAwIpKCsRJuZGJkNsK+leu88ZluQc24KW4pk3QFuSe76OjdTuI+2COyR1iTU X-Received: by 2002:a05:6830:1bda:: with SMTP id v26mr2911738ota.314.1581698541484; Fri, 14 Feb 2020 08:42:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698541; cv=none; d=google.com; s=arc-20160816; b=K23pZjCI+3g5hPzsS0nDSt58ogid+hAAvoQgePZws/bccDKj1wlXhixPLUJabkh63c c7u4qeXcE1e2uzL9c6QadHOpvphC+/m+a0O7gL+TnpcysHoJEvl8iutc32fd5US97jRG 6HLbTuP7OBiaDM3oU1A8trOdpkn1obM62S1FG5loy4IyR32RTqVL0Sehxgb9GYW4RK+t 2Sm+UYLVvFmtsIee5sNAX49AeOJuoA+sK2F7vC+g5BIN15X5PmhdLfFQ4iCAxZL484G/ SSM09bY2x507a6q34E3XXIXq4fHuOtqFMR3ng+O+FxyCLv5sKdRGFrAlQKA5BGqqYn2y X63w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=oLvO6eM9BU7rmH5ae7pAU/ybR3uMIY/JphPAHBj+KLU=; b=FbPvY+VH/Tff6QAoYsWb/gRCxF+CKJW76NOm31mv6T2X1/yMshg5vb21S0G+la7Yvd 4mmfmUhYLicdANgS9v0r4ZQJahl3w06i/69D1eN5EGYwo9eQh1VfdqxTQeEoyLKth6wF G3fLGlLNv090tKMG/ZkJE09s6dHgJRmp+Z1qPyNF+WRDaKaCKNbUIjzw85QzAt5kQpjd GghtwS8rKYzMWqmvLMaMmazpjLD6zOLFSKWzf/uq5ZhNeyu7Bon/J1seTT0q5A+yF1SP UVl4IxkHHcOB5xr3XLPS2WO4LJcqJB1J44efyR31eTV9nETDpWngIQer1VYDZq5Re6tU iKTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qjCRc6qY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2si3219584ote.9.2020.02.14.08.42.09; Fri, 14 Feb 2020 08:42:21 -0800 (PST) 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=qjCRc6qY; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393690AbgBNQkc (ORCPT + 99 others); Fri, 14 Feb 2020 11:40:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:58764 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393263AbgBNQWx (ORCPT ); Fri, 14 Feb 2020 11:22:53 -0500 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 0340D24762; Fri, 14 Feb 2020 16:22:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697372; bh=dE5/nvNLJI0zjMewiymZtePjfK0j8kzyC/D2KWwxLCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qjCRc6qYUnA+U1NUGnDbkaINSIeWrQzCsmicjFT9SLDaDH/8wDZrEj1+ECi3Loo5K 4C7BwkesRCSb91y2JNgY5yqnuZrgL5xS5LdaAu3LIv6M7CGXFYuwwhwRStLeMsuIxL wNnbSEazBYghHqADuwC1nklnbE1N+rzIG6oQuzO4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Paul Kocialkowski , Alexandre Belloni , Sasha Levin , linux-rtc@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 071/141] rtc: hym8563: Return -EINVAL if the time is known to be invalid Date: Fri, 14 Feb 2020 11:20:11 -0500 Message-Id: <20200214162122.19794-71-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-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: Paul Kocialkowski [ Upstream commit f236a2a2ebabad0848ad0995af7ad1dc7029e895 ] The current code returns -EPERM when the voltage loss bit is set. Since the bit indicates that the time value is not valid, return -EINVAL instead, which is the appropriate error code for this situation. Fixes: dcaf03849352 ("rtc: add hym8563 rtc-driver") Signed-off-by: Paul Kocialkowski Link: https://lore.kernel.org/r/20191212153111.966923-1-paul.kocialkowski@bootlin.com Signed-off-by: Alexandre Belloni Signed-off-by: Sasha Levin --- drivers/rtc/rtc-hym8563.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rtc/rtc-hym8563.c b/drivers/rtc/rtc-hym8563.c index e5ad527cb75e3..a8c2d38b24112 100644 --- a/drivers/rtc/rtc-hym8563.c +++ b/drivers/rtc/rtc-hym8563.c @@ -105,7 +105,7 @@ static int hym8563_rtc_read_time(struct device *dev, struct rtc_time *tm) if (!hym8563->valid) { dev_warn(&client->dev, "no valid clock/calendar values available\n"); - return -EPERM; + return -EINVAL; } ret = i2c_smbus_read_i2c_block_data(client, HYM8563_SEC, 7, buf); -- 2.20.1