Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2616954imu; Tue, 6 Nov 2018 18:41:01 -0800 (PST) X-Google-Smtp-Source: AJdET5d3no9mn6jMWO7yH/5yaAs/WhvmW7upqpou54hHCjL9LVTxlc8/zd7Vx4vUzkCjLIRfc4gi X-Received: by 2002:a63:1d10:: with SMTP id d16-v6mr107993pgd.228.1541558461059; Tue, 06 Nov 2018 18:41:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541558461; cv=none; d=google.com; s=arc-20160816; b=UkKMOX+GasYdz3ucAHaestfL2OOd94BJdB7snSnO6rFNh+yhVsHy6cJfDdnVeTnMDA qxdSK0oY3hQDRRWobebV1Jr5mpkMau83zj4xLem3wo69+P9qyjWtbqQyR0s3Vqpjpapt xoFwgel/C4Fe0hdoYCRjcNObWgeD/Mk/MOlX4Fee4607rS4ftXjz+KjogctlRkmScios GN3XlkQGOj8gS7S5eyFQ5TWDwX2cGI9weT4fLpV9lnug771ySWSLoAcCxNS7It8DLUl+ 3Mjqv+1qpQni+kdQrA/RRLqtMdZAEaj0H1G/zTng1ZCEi6KOGNfM4yOmHEXZU6FruwRk 7MCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :subject:cc:to:from:date; bh=zD42LcvHp4Gt8FhbtfcWo8YlWH7R/dUVG9TNYuRrnlc=; b=CCxH4mxuqzw63PpiT5Pbl1urEamhfBpK2+H5wITVSTIvOooOruzHdVzN7fOm9GrLeZ houkqZah30orZAWw+XQv2JbvxQJDq7QqOqRhbnjGQthb82rZI/tZzuwYIRRHTJFpbuC5 gm9LAmvz6YkU4GoBa4dH+hb+neMoLUX+E8znzvKAl5RwWSCZ8t2SJ3gZvVYaPFfBMh0o x5m+qdFeZnmnqOKTP1+u5qbGxkea27BXvK7hdh6Wi0UHBAvh0eIOjtnioQwY4NrG6IRx q0rTTxCkRbnni92CxNHOzAcX8zZQ25os85MS7Xigq2bz4nYqECQH8oSFAU21QR6qyCsS O/GA== ARC-Authentication-Results: i=1; mx.google.com; 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 g12-v6si28198687pla.351.2018.11.06.18.40.46; Tue, 06 Nov 2018 18:41:01 -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; 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 S2389347AbeKGMIe (ORCPT + 99 others); Wed, 7 Nov 2018 07:08:34 -0500 Received: from eddie.linux-mips.org ([148.251.95.138]:41150 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389296AbeKGMIe (ORCPT ); Wed, 7 Nov 2018 07:08:34 -0500 Received: (from localhost user: 'macro', uid#1010) by eddie.linux-mips.org with ESMTP id S23992820AbeKGCjvVMmyO (ORCPT + 1 other); Wed, 7 Nov 2018 03:39:51 +0100 Date: Wed, 7 Nov 2018 02:39:51 +0000 (GMT) From: "Maciej W. Rozycki" To: Alessandro Zummo , Alexandre Belloni cc: Matt Turner , linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] rtc: m41t80: Complete error propagation from SMBus calls Message-ID: User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Complement commit 85d77047c4ea ("drivers/rtc/rtc-m41t80.c: propagate error value from smbus functions") and correct the remaining places that fail to propagate the error code from SMBus calls. Signed-off-by: Maciej W. Rozycki References: 85d77047c4ea ("drivers/rtc/rtc-m41t80.c: propagate error value from smbus functions") --- Hi, I think this does not qualify for backporting, but please feel free to decide otherwise. This change I did verify at run time to the extent I was able to, but I didn't try to trigger artificial errors. Also the M41T81, which is the device I've been using this driver with, does not have battery failure indication implemented, so I could not execute the procfs handling path (again without making some artificial changes). These changes should be obvious regardless. I'll be posting further patches over the coming weeks, based on my original effort as archived here: , However I have just realised they'll need another iteration before I post them. So for now just these two obvious fixes. Please apply. Maciej --- drivers/rtc/rtc-m41t80.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) linux-rtc-m41t80-err.diff Index: linux-20181008-swarm64-eb/drivers/rtc/rtc-m41t80.c =================================================================== --- linux-20181008-swarm64-eb.orig/drivers/rtc/rtc-m41t80.c +++ linux-20181008-swarm64-eb/drivers/rtc/rtc-m41t80.c @@ -217,7 +217,7 @@ static int m41t80_rtc_read_time(struct d sizeof(buf), buf); if (err < 0) { dev_err(&client->dev, "Unable to read date\n"); - return -EIO; + return err; } tm->tm_sec = bcd2bin(buf[M41T80_REG_SEC] & 0x7f); @@ -274,10 +274,11 @@ static int m41t80_rtc_set_time(struct de if (flags < 0) return flags; - if (i2c_smbus_write_byte_data(client, M41T80_REG_FLAGS, - flags & ~M41T80_FLAGS_OF)) { + err = i2c_smbus_write_byte_data(client, M41T80_REG_FLAGS, + flags & ~M41T80_FLAGS_OF); + if (err < 0) { dev_err(&client->dev, "Unable to write flags register\n"); - return -EIO; + return err; } return err; @@ -287,10 +288,12 @@ static int m41t80_rtc_proc(struct device { struct i2c_client *client = to_i2c_client(dev); struct m41t80_data *clientdata = i2c_get_clientdata(client); - u8 reg; + int reg; if (clientdata->features & M41T80_FEATURE_BL) { reg = i2c_smbus_read_byte_data(client, M41T80_REG_FLAGS); + if (reg < 0) + return reg; seq_printf(seq, "battery\t\t: %s\n", (reg & M41T80_FLAGS_BATT_LOW) ? "exhausted" : "ok"); }