Stable Archive on lore.kernel.org
 help / color / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Evgeniy Polyakov <zbr@ioremap.net>,
	"H. Nikolaus Schaller" <hns@goldelico.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	YueHaibing <yuehaibing@huawei.com>,
	Tony Lindgren <tony@atomide.com>
Cc: linux-kernel@vger.kernel.org, kernel@pyra-handheld.com,
	letux-kernel@openphoenux.org, linux-omap@vger.kernel.org,
	stable@vger.kernel.org
Subject: [PATCH 2/4] w1: omap-hdq: fix return value to be -1 if there is a timeout
Date: Sat, 23 May 2020 19:32:55 +0200
Message-ID: <b2c2192b461fbb9b8e9bea4ad514a49557a7210b.1590255176.git.hns@goldelico.com> (raw)
In-Reply-To: <cover.1590255176.git.hns@goldelico.com>

omap_w1_read_byte() should return -1 (or 0xff) in case of
error (e.g. missing battery).

The code accidentially overwrites the variable ret and not val,
which is returned. So it will return the initial value 0 instead
of -1.

Fixes: 27d13da8782a ("w1: omap-hdq: Simplify driver with PM runtime autosuspend")
Cc: stable@vger.kernel.org # v5.6+
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 drivers/w1/masters/omap_hdq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c
index d363e2a89fdfc4..9f9ec108b189e2 100644
--- a/drivers/w1/masters/omap_hdq.c
+++ b/drivers/w1/masters/omap_hdq.c
@@ -464,7 +464,7 @@ static u8 omap_w1_read_byte(void *_hdq)
 
 	ret = hdq_read_byte(hdq_data, &val);
 	if (ret)
-		ret = -1;
+		val = -1;
 
 	pm_runtime_mark_last_busy(hdq_data->dev);
 	pm_runtime_put_autosuspend(hdq_data->dev);
-- 
2.26.2


  parent reply index

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1590255176.git.hns@goldelico.com>
2020-05-23 17:32 ` [PATCH 1/4] w1: omap-hdq: cleanup to add missing newline for some dev_dbg H. Nikolaus Schaller
2020-05-23 18:09   ` Tony Lindgren
2020-05-23 17:32 ` H. Nikolaus Schaller [this message]
2020-05-23 18:11   ` [PATCH 2/4] w1: omap-hdq: fix return value to be -1 if there is a timeout Tony Lindgren
2020-05-23 17:32 ` [PATCH 3/4] w1: omap-hdq: fix interrupt handling which did show spurious timeouts H. Nikolaus Schaller
2020-05-27 16:46   ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2c2192b461fbb9b8e9bea4ad514a49557a7210b.1590255176.git.hns@goldelico.com \
    --to=hns@goldelico.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pyra-handheld.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tony@atomide.com \
    --cc=yuehaibing@huawei.com \
    --cc=zbr@ioremap.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Stable Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://lore.kernel.org/stable \
		stable@vger.kernel.org
	public-inbox-index stable

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git