Message ID | 20240205114826.39036-1-joychakr@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-52519-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp826944dyb; Mon, 5 Feb 2024 04:06:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIOa7GhyhUS7XacTQMQNuSCM0aNIi4p3O5Kw3GISti8kVQwsRhL1Hjb9HM8Yfv9FpZU3Ul X-Received: by 2002:a05:6a20:d48b:b0:19c:5651:adc1 with SMTP id im11-20020a056a20d48b00b0019c5651adc1mr16883905pzb.38.1707134760734; Mon, 05 Feb 2024 04:06:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707134760; cv=pass; d=google.com; s=arc-20160816; b=PInjPFAXAXLJxbtHQZBHrS0Ytaz/36RTUARJyInpNEx9hmGqs89bzZmlZ+khAZSMbz PypCszMsCL0xTfJNe84PYWedVzeCX/tOIpbp1LTcLTNcp0k56fF5C+LDR7zOc48RblA1 4Q7EL8pEnpCs4zh7rCpZRm19pSmZYnW1djJVq4PyBbYWdX7Lgmq/jeczPU6Irb2XROdM XIwwHiDx101q4ll5Q24xfmhzGl0UbiCCwMWm9Wg+v1i0RKUD5ZMo/tHsCsbD8hg5e/lJ rfccoooi6LacPor7EOKIkvHCgUpgUzoUk4v5SNENiMRbbTcs/F3sHgj1WGb2+Ou2xi6F DlrA== 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=u9pWmEPb+QInAD00/XoRdhrFOb+26lZmMlfpGr1ljBY=; fh=FsN3qeuR82wgXJdxaF7gYuoLEWO+CxazALGk8qH6wZw=; b=Xyp5nHQ9jqD53bpjsAlJeOYWUigGJwey3yo+QtoFpVSEp3nynZhBPC5b0HbmZnWGZJ iiB/Up0RrJAVPCiKwPwiIgm8U07xXoAsY2Z2Wsn2adP12ZGF5pVaTzYXF6/HLlQdtpl6 xByDECvnuLzeHOAxbjDRC8bEjXLzv3XaxfHuD63grwT0uy51qIRQcMLngTVJ7mmmUwaZ 9hcGGaybhWJhvvTPslChaTqMrJxwXk0Enqd37zOeZbfwXzWUDy4rYUPLDl5Y5MO03ued WvxkRFpT5NExfTbnbosUZ5U0zKXsH3hhA1cjpzcXz/0Porqw0iUObR23GggE+MwtNTfz n2lQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aJLkMblF; 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-52519-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52519-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=1; AJvYcCUY/90N4+XDnrDBau3Xym6aztO3McLBGVVtLBz5lKNKP+cXBCRWGkLQSeuQ5HKiayhqHyHz82/fiSqapeLHNCTKOmuVug== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f8-20020a056a00228800b006e045c00fbesi1467306pfe.177.2024.02.05.04.06.00 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 04:06:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52519-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=aJLkMblF; 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-52519-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52519-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 226C5B240FA for <ouuuleilei@gmail.com>; Mon, 5 Feb 2024 11:49:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CEAAC1AAD2; Mon, 5 Feb 2024 11:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="aJLkMblF" 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 883981AAB9 for <linux-kernel@vger.kernel.org>; Mon, 5 Feb 2024 11:48:56 +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=1707133738; cv=none; b=EV6frs794abb6BY2m/ZhfFTGXp2Elh2TigKrtKzfRkVdhqDgmYqX6nbpS2qK9BwOOGhNiaIwNLFXxKbDQ8wGaLtqIMLHaUrpd6I6MRJpuOIL2k9eLqt4TqWhVDGgFkhCm87neNM17cGZlHNMNjSlGSptHP90KEDc3yfDNWYIHE8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707133738; c=relaxed/simple; bh=66nJ5U9a3ygOX+4bgNF22AZhA969qXdhW9QnM1tqb+U=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=M3Li8MZ8E7TXPwaDUHiF2A2MI64bjvgDhVPkAXz/n6giuUB3JGfjFRJO2LlS9zUAEvFkpaY0T8PQO9c1cgnLzcB/QOJmt55xHv9U1cZln3AT70MBzbTwLySqLAlJU4PNdm2Uecf97v1T+JoclKhIF11fZ2X/s2U2UPrlFbd5B9k= 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=aJLkMblF; 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-60402c8d651so69541557b3.3 for <linux-kernel@vger.kernel.org>; Mon, 05 Feb 2024 03:48:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707133735; x=1707738535; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=u9pWmEPb+QInAD00/XoRdhrFOb+26lZmMlfpGr1ljBY=; b=aJLkMblFWBL9XVc1PJoJXSkm8ljOnaOEEA6+3BswwYhNIKmh2NNRjD05c8GUrp8m3V BnC6dQ4Rt/0+NE6pGEs4Lv/lSzV/937B9X86IsZYHhHi+WIPxxR60TXpfasrKE4HeUhU vlm8K5DezmD5/PChIFbj2PqVFCt8vJft+qlzEhTzSQRI+LSWU/f5lThHdo2rIm2tFYBz Mk684qg2sk8zdUxYzYPXcdLBt39ox9akjoH7Ka/iZBZvsTvkilrD1yIegcTWjnxxNh+Z R+9zLzErx1vNDVx/Ypm/a8F2IGXb/2s8RgkdN8nSQYeieoKH7/BVbo/Pp2iYh+heXsgh YwWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707133735; x=1707738535; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=u9pWmEPb+QInAD00/XoRdhrFOb+26lZmMlfpGr1ljBY=; b=WjKofLWAnf3gDjapLzjOdzjTwUqOzded4Ssfs1bBGe4e90/2OxHHyZ8Zp4OWjXYSaz 1P6OIYUYjwK5A8oPyCzArEBPoCkQIVjrjHoqM51j43Pg5iq7QDPL2/M2c5pg7P5swa8h xr99bTO6kKKfIKPGNQYkIycvFxSQoPHL+YO8rWxtug8Ev2sI92h8PhZZxEG9++acGKgB lOpY9suKARadtJJUf9LRikd3vFanaOVg4WA6sJ+Q0jwf3gMe84B7jp1lrGmP9/OVwXP/ yVQjWy8tnqSxqhYnWbdIQDclggpZjDQGxJoUVceuVntkIQTSwPFegBKofQjlAXBaEE3y mgOg== X-Gm-Message-State: AOJu0Yw0uTgIRftuVPUEzcFFvVhUpWGHYJ1zPSm5yxkmlTsPX2qAN9/W ZcekiPZnJIFR1FVeRJXUzZUw/NSnB2bzVVEhUP6/PdnQt7eHy7X0PC3C3mswGlgqKCTBFLB7Cmy n5IL+Z65r5g== X-Received: from joychakr.c.googlers.com ([fda3:e722:ac3:cc00:4f:4b78:c0a8:6ea]) (user=joychakr job=sendgmr) by 2002:a05:690c:39d:b0:5ff:5135:ffcf with SMTP id bh29-20020a05690c039d00b005ff5135ffcfmr2388161ywb.4.1707133735545; Mon, 05 Feb 2024 03:48:55 -0800 (PST) Date: Mon, 5 Feb 2024 11:48:26 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Message-ID: <20240205114826.39036-1-joychakr@google.com> Subject: [PATCH] nvmem: rmem: Fix return value of rmem_read() From: Joy Chakraborty <joychakr@google.com> To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Rob Herring <robh@kernel.org>, Nicolas Saenz Julienne <nsaenz@kernel.org> Cc: linux-kernel@vger.kernel.org, manugautam@google.com, Joy Chakraborty <joychakr@google.com> Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790060538758154620 X-GMAIL-MSGID: 1790060538758154620 |
Series |
nvmem: rmem: Fix return value of rmem_read()
|
|
Commit Message
Joy Chakraborty
Feb. 5, 2024, 11:48 a.m. UTC
reg_read() callback registered with nvmem core expects an integer error
as a return value but rmem_read() returns the number of bytes read, as a
result error checks in nvmem core fail even when they shouldn't.
Return 0 on success where number of bytes read match the number of bytes
requested and a negative error -EINVAL on all other cases.
Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem")
Signed-off-by: Joy Chakraborty <joychakr@google.com>
---
drivers/nvmem/rmem.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Comments
On Mon, Feb 05, 2024 at 11:48:26AM +0000, Joy Chakraborty wrote: > reg_read() callback registered with nvmem core expects an integer error > as a return value but rmem_read() returns the number of bytes read, as a > result error checks in nvmem core fail even when they shouldn't. > > Return 0 on success where number of bytes read match the number of bytes > requested and a negative error -EINVAL on all other cases. > > Fixes: 5a3fa75a4d9c ("nvmem: Add driver to expose reserved memory as nvmem") > Signed-off-by: Joy Chakraborty <joychakr@google.com> > --- > drivers/nvmem/rmem.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) Hi, This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree. You are receiving this message because of the following common error(s) as indicated below: - You have marked a patch with a "Fixes:" tag for a commit that is in an older released kernel, yet you do not have a cc: stable line in the signed-off-by area at all, which means that the patch will not be applied to any older kernel releases. To properly fix this, please follow the documented rules in the Documentation/process/stable-kernel-rules.rst file for how to resolve this. If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers. thanks, greg k-h's patch email bot
diff --git a/drivers/nvmem/rmem.c b/drivers/nvmem/rmem.c index 752d0bf4445e..a74dfa279ff4 100644 --- a/drivers/nvmem/rmem.c +++ b/drivers/nvmem/rmem.c @@ -46,7 +46,12 @@ static int rmem_read(void *context, unsigned int offset, memunmap(addr); - return count; + if (count != bytes) { + dev_err(priv->dev, "Failed read memory (%d)\n", count); + return -EINVAL; + } + + return 0; } static int rmem_probe(struct platform_device *pdev)