Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp1168167lqt; Fri, 7 Jun 2024 09:47:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWyD+5a3z1DNEmPHy5FnMJNcwrPlWP2Bf/I/ygBZEMV1o+pVomHZ5aq48Nq5tf6xgGgtrP3pQFQTZtlsmghMh3ZAI/HMMHuzOJPv9J+Zg== X-Google-Smtp-Source: AGHT+IFRqEWQKjEK5chmI4BAh2H7dUoSDDgbin+thEsidAwY9nXi/s58NEhtn12mHa8qD5x4g2pC X-Received: by 2002:a05:6870:219c:b0:23e:b430:3f87 with SMTP id 586e51a60fabf-25464451579mr3241422fac.2.1717778860708; Fri, 07 Jun 2024 09:47:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717778859; cv=pass; d=google.com; s=arc-20160816; b=vRQ8jbgt8syKPO+5XjBPPXtyyCUAs//MZMnm+jZ9p3cR4jf5tCIgZAoMBY8KaIrYjO nGtnRYmaTtTqlinbWrOB5utXNUnEbxThsb9xXhiSHGyKv3Fm/9yt4Fx1184v+HEEIlD4 htWrdgc4OQvgkD4eqv4yhvCM9HQyd20qx6Ksk+BjnSN/Xm+Aarx7cEIoOZa11Idgnn26 wgK3SX9TqBsaMXUCkYiifBa52sZ+oCj3wZO67YCp4lpT/fsyv6ZHcM+QZxK0QPLV3Fg8 7kykDA7UJU8E9IrDx4XMG4xURm5Txw+723bS+LWAWD5XUw3890gz8Y2QUpB/yLPAGC8t TEJQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VEc27/+QDjvxPdxrPe9MQft414aDa0ng2g5tZw7JHxo=; fh=YAn+5b7bRIam7RYQZCc5v2RvXJYShj8ay1V/x6DH5Bo=; b=YABMLHnVpa1HMJxrnaYrKjY9ettg2WOzsX9a/qtSC0fU37gONppMVJ+8w7ftLulMMd 5evesVUqISQa2RwVZTdfXx8SSFADCChppK/F2vYb8Ld0evby7TNFxKQm8yLNAMowTppn CdrWf2TK837vseBlcvC1l/XJMsM6O90f2BWAJGrKUbYxHcWlynyNN1zhLjB3KpzSuyS8 cMrzLJMXj6RkSjteTfLecrhIVzwZp2LnviNJz2gXqKjvoR4M0PeowBIw2FnN9ghV19Wr CnQpbySfPdZUOXSnuBbsDDLtzU9F2JRe+WkP6KSZzT8sTWTSwIFDbuuPXlssn5YGfqgC sQ0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O6HnjGYK; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-206506-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206506-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6de262c0d78si3265360a12.293.2024.06.07.09.47.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 09:47:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-206506-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=O6HnjGYK; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-206506-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-206506-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B5B0289880 for ; Fri, 7 Jun 2024 16:47:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA19C19AD84; Fri, 7 Jun 2024 16:47:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="O6HnjGYK" Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 2C19A19AD4B for ; Fri, 7 Jun 2024 16:47:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717778834; cv=none; b=NFRO0fFgm5gsj4FEDzoLkBtovNasKOcTYdMKy5zJjLLXe09kV75WaNM/KKUsHD8dH9BjiGnwv8NjrdlhdNQR7wlDMLDviWPruv3W+LBWmUyNSRhep1eNdFbkAAglBuicrxxwMB/PcCbXGLreQvNquA8cC3HBpyw/IJtEXRa5wKc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717778834; c=relaxed/simple; bh=yygfjpWf7c4mRu3wc8784otqW9r1u1MIqacYFxxAi/s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QfgTJukzb8pgpic52jfnexz03WCAE8sbl03cX1mPfcmtBzxH65QgnuGLzC5WIQaDuZiN4UJ8jca5EBT0/IK8wiJWTUknUiI+5Jj5BW0hD856s4c23Pm97OipNJflBw9Qs0WzLF8mLn5aV6ObdFIBL+P+7BaeMonYTPbCV0dMm44= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=O6HnjGYK; arc=none smtp.client-ip=209.85.167.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52961b77655so2674450e87.2 for ; Fri, 07 Jun 2024 09:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717778831; x=1718383631; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=VEc27/+QDjvxPdxrPe9MQft414aDa0ng2g5tZw7JHxo=; b=O6HnjGYKklXmJwur7DN9WWBSz670aIuc6FXFT0vE1sCHQvHND3ZvYqaeIyexF/P2z7 kxLJiyGFaj3XDyshOb4PDlLaNC6MTbUa2PymOPFHq/ECncaaDiA5kFRjW8kbbVPUWMUY iWGpBw9NERdvzsMvjrxgQyzQHgoWf4+7jV77zUR+arDzxxZRBBB2AgAnGc/9mEOm6iut nti2iCgu+IjqMLcMMC70PZn2OwMoIAGxCm5SccyoZYWSVKTnBPt15z5yzKkeROGuGSyL fxMyPy6GfikIF/rmECDfy1zK/vxF9aCeLbR6OjPk8vmXtcmKpCE0+AQWcm/Ojk63vzt2 1dRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717778831; x=1718383631; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=VEc27/+QDjvxPdxrPe9MQft414aDa0ng2g5tZw7JHxo=; b=JHBr2CM/24aIkkD40NRoZ4ohRTqr1/NBqOXZ2N929XGI2Im4h1gAboUgifbcOxv2m1 q2AmIb93S+pms9ZtZKPoCWqO4VigY5DLq8trcSNlQUQVZ4qOqQpz+lpOhicJWzLAfxN/ 0knRnGiCUlHapQZgvcK0le4tt8Vs7HYqc8HMqh4Oy0j49KOgf58wChuYTnlugGnT8siG 6r01X82bwGEhnKWdGUu24p1wjcoRcxBA0x06S/Kh6ZgTCbPzsa6G0jUr2hsxoQc6hSxx Xyl3cDRSaKYB2ZJV6p1GFhgO5tfB/YKzWi9VtS6r9YoN+2nJjz0F9b29MDis1OYFYbi4 iGTg== X-Forwarded-Encrypted: i=1; AJvYcCVESDaiGobwSyGjDovWH/g3IPX4ai62ol76lvM7tYEIIsreUEVaC0sYRzLuisb3YxHuz8khiqXqQx3M2hfa9FTADYQLa/NgABTR3toS X-Gm-Message-State: AOJu0YzMUd4ykR63TkEtb5uK8RpCiq0OHg3JRWJUtLMS3ToLJYuIBNdF BoF+FBVoh8tYL+JFuAcfz7G7IuZslgySqBIf30hisoK1V5LvuS/1vHHK+iBWsLDw8frVQXy38la X X-Received: by 2002:ac2:5e91:0:b0:52b:c294:f005 with SMTP id 2adb3069b0e04-52bc294f418mr764139e87.12.1717778831114; Fri, 07 Jun 2024 09:47:11 -0700 (PDT) Received: from localhost ([102.222.70.76]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6c8058272bsm273700566b.18.2024.06.07.09.47.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Jun 2024 09:47:10 -0700 (PDT) Date: Fri, 7 Jun 2024 19:47:06 +0300 From: Dan Carpenter To: Joy Chakraborty Cc: Srinivas Kandagatla , Greg Kroah-Hartman , Rob Herring , Nicolas Saenz Julienne , linux-kernel@vger.kernel.org, manugautam@google.com, stable@vger.kernel.org Subject: Re: [PATCH v3] nvmem: rmem: Fix return value of rmem_read() Message-ID: References: <20240607160510.3968596-1-joychakr@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240607160510.3968596-1-joychakr@google.com> On Fri, Jun 07, 2024 at 04:05:10PM +0000, Joy Chakraborty wrote: > reg_read() callback registered with nvmem core expects 0 on success and > a negative value on error but rmem_read() returns the number of bytes > read which is treated as an error at the nvmem core. > > This does not break when rmem is accessed using sysfs via > bin_attr_nvmem_read()/write() but causes an error when accessed from > places like nvmem_access_with_keepouts(), etc. > > Change to return 0 on success and error in case > memory_read_from_buffer() returns an error or -EIO if bytes read do not > match what was requested. > > Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem") > Cc: stable@vger.kernel.org > Signed-off-by: Joy Chakraborty > --- Thanks! Reviewed-by: Dan Carpenter You mentioned some other functions that had similar bugs. Could you fix those as well. regards, dan carpenter