Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp285199lqp; Wed, 12 Jun 2024 01:09:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBfyg9vJbwtJaVpuRVC0tB29ztpCDxJ0qS4wyVh8p80c8NcBpuB1zRLaG1cFf1X+dBHozgLT5avC89WP/ho91Cqq4q7PvLn2jsCfW1+A== X-Google-Smtp-Source: AGHT+IFpWCVE+z7ykbOIGa5p4+nx9UErGgkfLdlGFtgjjpGWyTOWOUL3AHdWsFiCgigR0azMS90I X-Received: by 2002:a5b:648:0:b0:df4:f44a:f72d with SMTP id 3f1490d57ef6-dfe6891f21dmr1024898276.50.1718179790711; Wed, 12 Jun 2024 01:09:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718179790; cv=pass; d=google.com; s=arc-20160816; b=ZaoYZH7mxcSJiWkEwfhzbYeYu3ERdqNVorBgfHSahHWuqR5DhXzCjGQB+B9uuWWbkK FZw/VjqKP+1JcN6YRbp8H2qezbRWtuYr4BbG7+Fhg0hBYpINzcvpUG/4eslM0KwAX/1H /pVZ21XnNysctEH482gquEbpOc/HX1jO5pJHmEiafcgukDFaT8FabO9R+rTFHdgEUEqm ejdK3z41S5W9B5Vpmy7Jz2qkGB2D8LMo7K9IhsFURbpEGBqGD9ZfCT2XCzpenKDYQmiu g7ixURISDtM7eaPgdW3gQ8J4R9dWECAjraBlvR/EYjilFVm25bmQKbENZ2A93kGYjrVx iHbQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=D7wZcftQ9M/yW4wOMYmHU4YilbwPgD+FPr90gUkx4Jo=; fh=6AnUL5Ih2tLNSI112ddeL3UeIX1WRyjBd+OpSoQkI6Q=; b=09RJR6CXfTKsUx41XK/emwKbhnGRR4ja3rqQcg6S8tI0C0QPpmjM4XHfRrt1RPHGrI OgzB6Oke6Fgu/QJfLZiPKc87ffxFpdxOrXLH/7RCLAZYpfYk5ozXy2k3YlCvyl05KUMD +8tDZDA+9J0OoArO49E2Jn14ilxn9x3+gQU6lIlYFidNOzkK02DyZagQ9T7n6AoFwNUQ KYT+V8swbhU5/UKM8T8y/Hs5M0HTAmXGznD4BB1HLq+Lq3yQEBBkwjIglZtYjM70H4LT mGRkAItBFGzeAsYUoO0zfBo7DQlmkmdsLo44buNOEF91OVIjN231WerPdPUAUdzhEKqQ ZuOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=X2FX80A+; arc=pass (i=1 spf=pass spfdomain=flex--joychakr.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-211145-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b0828341cesi58799366d6.588.2024.06.12.01.09.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 01:09:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211145-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=X2FX80A+; arc=pass (i=1 spf=pass spfdomain=flex--joychakr.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-211145-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211145-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6C3FA1C20885 for ; Wed, 12 Jun 2024 08:09:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE75616C87B; Wed, 12 Jun 2024 08:08:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="X2FX80A+" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7E76816C847 for ; Wed, 12 Jun 2024 08:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718179720; cv=none; b=J94rdK/cp3ls+7sHAska96k3ukqYcAGBQnCu68Ox0byEkBATkruWGE4vuGpnD1meehODYkNfEJPQTTwsmxf5NrtmXK2URoM3tJCa5gOUz6PTJmpJ0+QqrgIvRk7Ai0T1iwNqioqhrbf27evpT+b3rW/Ts92xZxcYnaTqJoc3pOs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718179720; c=relaxed/simple; bh=em6ArzsA1tRoEmAp99yMuwK6zz4EyOuG0naI3YxS0zY=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=IjumMsrkWOlP3QdZecp7U/QWte2ojibFJN4fTM0K4tNgN9sv3uM1koiX5/VO1G+dSiZQnWivWMn2/DwiiTkfYADVesDB0sidWwVO1uS+UiHahhG+WvA7xN5zCVLO47f7BpRkEMi8uTRV3WKhHLTpFKSyvvRNGsrMnWvXbUw1IV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=X2FX80A+; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--joychakr.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6302067d548so2779537b3.0 for ; Wed, 12 Jun 2024 01:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1718179717; x=1718784517; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=D7wZcftQ9M/yW4wOMYmHU4YilbwPgD+FPr90gUkx4Jo=; b=X2FX80A+3BD6G4gmpv671EYunMRBPnvJ8Xs7m1GmjKbnGPCoMmvAkPFqZEpyFfTUfD OOutjUz0OX1gnPhq9YdAssUmRF4IUcjJC96U148zEBBfmci3sFSdI8Gt6umYkmjvCHsY 9CCX8Gg6xYBfLoHZ2JxH2BE3tGCLxXgN1g2R4LFeienEQGLx6qWb3p7RNgygaFSGGpqP ynrob8T9rk4P1cm65W+xUaRb69+NeSYbOgUHHJ7YsowjSQ80sJOVYCMu5nKsF71at0QV UxTeh1irB3MUeG0oeKNfCL0bbT2Pld6jQxvnCsS/WcNF7G3pR0L3NP202Dhva0Jw86bj nHcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718179717; x=1718784517; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=D7wZcftQ9M/yW4wOMYmHU4YilbwPgD+FPr90gUkx4Jo=; b=NHDj3BCZw6pYIxYyGyYIAtZ+ZqlvAzGSrzSPQY0fkQ701x8mZ4vP2g/nZE82u894Hl fiHRuoSbA2sg2Lo7bIaPajyXO4LTqFpWei7d4MczQ3e1iU3edhCUNCbYbAlbLwsWMmTD bu4DKwM1KweO3CyBIbtasTQEZKELKcV1cBnsne+3zVnOUCc8YOLQGj19NfKjjhQmOWkz L31oOuXIpQTN4EAUp0xieTAYdjywnlpGGSsh2TVA6E7utrHO4QlnP42g+/EVR3qaDAai 5wfPx0EV4RZYOasVG5W+eouZ34tt0Zai/T4JsOvTo/08GgtX7kzBVT+38OUo0Jb2owj7 V12g== X-Forwarded-Encrypted: i=1; AJvYcCXk421RtzCZsT03JBpIT5fucmmrqleuBZynA5uQykulSNxhs9WhsZA5kYycjS/JU9lgDbaFGO07tBxylKZWCkKKsL2hDeg7N6uXWKY1 X-Gm-Message-State: AOJu0YxX/J0nMtLnYk/IStLVGpjs95Fao3Vl/GApNt87m+w9acsUUzll pnIsx8dsDe1OpE39/Ij15AZ5HsGCUD8QTMQPSnjGMNjeiiOb3t2u5C5py5O+yxgLKpg2G47A8gm DEAKCCFF7YQ== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:d8f:b0:62d:42d:5f73 with SMTP id 00721157ae682-62fbb6fb1b8mr3478157b3.5.1718179717496; Wed, 12 Jun 2024 01:08:37 -0700 (PDT) Date: Wed, 12 Jun 2024 08:08:31 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Message-ID: <20240612080831.1227131-1-joychakr@google.com> Subject: [PATCH] rtc: isl1208: Fix return value of nvmem callbacks From: Joy Chakraborty To: Alexandre Belloni , Trent Piepho , Srinivas Kandagatla , Dan Carpenter Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org, Joy Chakraborty , stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 --- drivers/rtc/rtc-isl1208.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c index e50c23ee1646..206f96b90f58 100644 --- a/drivers/rtc/rtc-isl1208.c +++ b/drivers/rtc/rtc-isl1208.c @@ -775,14 +775,13 @@ static int isl1208_nvmem_read(void *priv, unsigned int off, void *buf, { 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, @@ -790,15 +789,13 @@ static int isl1208_nvmem_write(void *priv, unsigned int off, void *buf, { 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 = { -- 2.45.2.505.gda0bf45e8d-goog