From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4322114831F; Tue, 30 Jul 2024 16:49:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722358162; cv=none; b=ENCmAVYJH7XItr4HImxMelFguo3L7DufrRHNbEQo9ZmZFVZXPxVsCcCPyETX2qIZlhkl1oWCkEt0VpwQXqyYMz6d5YIuQRa/cQAYN7g9XrlspICnUWU3Ym0GOpQNBn2hRaYoK/+t73pgbuZAA+XHKsbS+Loee8Q9VC5QCMnX2Uk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722358162; c=relaxed/simple; bh=2S9rpcZr1Qi7AsHu/lB+TJXRNzjFxj+Era6vfMoru6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sqjusf/wBOW8O5czDrqK5BtAOp1JrYNIBJDLMS2g0pJpKiuF+acknQh+rSQ4uUQ2NTQ4hCidGslwjx2LseFxnj3qdJYLmpAkSLegQxZ9o3vIW1k67O4NacVaj7XXMgWhH8Mp8c1iONCS+rQRmFKcV2isbCBH6UcHpgBJV0f94rU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=0/DCiLF9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="0/DCiLF9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A0A7C4AF0C; Tue, 30 Jul 2024 16:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1722358161; bh=2S9rpcZr1Qi7AsHu/lB+TJXRNzjFxj+Era6vfMoru6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0/DCiLF9DRlNnRGC1jMGOmiBu6Ecxj4XQMWlj1/Je5n/u/eVZoZIyUnmHiS3Qzxnm lo63a7n7w0aHwhLojh7L7gnbcCdeO3oOarPN4x5xyFpUA6pJ/ZQKt5rmnM+c4y2PqV eVm14Y4IYTk/oAfomFH/0XwMxripp2ReaW3auXQ4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joy Chakraborty , Alexandre Belloni Subject: [PATCH 6.1 362/440] rtc: isl1208: Fix return value of nvmem callbacks Date: Tue, 30 Jul 2024 17:49:55 +0200 Message-ID: <20240730151629.953748839@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730151615.753688326@linuxfoundation.org> References: <20240730151615.753688326@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joy Chakraborty commit 70f1ae5f0e7f44edf842444044615da7b59838c1 upstream. Read/write callbacks registered with nvmem core expect 0 to be returned on success and a negative value to be returned on failure. isl1208_nvmem_read()/isl1208_nvmem_write() currently return the number of bytes read/written on success, fix to return 0 on success and negative on failure. Fixes: c3544f6f51ed ("rtc: isl1208: Add new style nvmem support to driver") Cc: stable@vger.kernel.org Signed-off-by: Joy Chakraborty Link: https://lore.kernel.org/r/20240612080831.1227131-1-joychakr@google.com Signed-off-by: Alexandre Belloni Signed-off-by: Greg Kroah-Hartman --- drivers/rtc/rtc-isl1208.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -743,14 +743,13 @@ static int isl1208_nvmem_read(void *priv { struct isl1208_state *isl1208 = priv; struct i2c_client *client = to_i2c_client(isl1208->rtc->dev.parent); - int ret; /* nvmem sanitizes offset/count for us, but count==0 is possible */ if (!count) return count; - ret = isl1208_i2c_read_regs(client, ISL1208_REG_USR1 + off, buf, + + return isl1208_i2c_read_regs(client, ISL1208_REG_USR1 + off, buf, count); - return ret == 0 ? count : ret; } static int isl1208_nvmem_write(void *priv, unsigned int off, void *buf, @@ -758,15 +757,13 @@ static int isl1208_nvmem_write(void *pri { struct isl1208_state *isl1208 = priv; struct i2c_client *client = to_i2c_client(isl1208->rtc->dev.parent); - int ret; /* nvmem sanitizes off/count for us, but count==0 is possible */ if (!count) return count; - ret = isl1208_i2c_set_regs(client, ISL1208_REG_USR1 + off, buf, - count); - return ret == 0 ? count : ret; + return isl1208_i2c_set_regs(client, ISL1208_REG_USR1 + off, buf, + count); } static const struct nvmem_config isl1208_nvmem_config = {