summaryrefslogtreecommitdiff
path: root/drivers/w1
diff options
context:
space:
mode:
authorLuiz Sampaio <sampaio.ime@gmail.com>2021-05-20 01:30:44 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-07-20 17:05:39 +0300
commit20c62caf2eaf05580397368bb813dff19f59d0e9 (patch)
tree222ed4a1c29ec2744989f6f1767253bd17d71e39 /drivers/w1
parent8e8d910e9a3a7fba86140aff4924c30955ab228b (diff)
downloadlinux-20c62caf2eaf05580397368bb813dff19f59d0e9.tar.xz
w1: ds2438: fixing bug that would always get page0
[ Upstream commit 1f5e7518f063728aee0679c5086b92d8ea429e11 ] The purpose of the w1_ds2438_get_page function is to get the register values at the page passed as the pageno parameter. However, the page0 was hardcoded, such that the function always returned the page0 contents. Fixed so that the function can retrieve any page. Signed-off-by: Luiz Sampaio <sampaio.ime@gmail.com> Link: https://lore.kernel.org/r/20210519223046.13798-5-sampaio.ime@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/w1')
-rw-r--r--drivers/w1/slaves/w1_ds2438.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/w1/slaves/w1_ds2438.c b/drivers/w1/slaves/w1_ds2438.c
index 5cfb0ae23e91..5698566b0ee0 100644
--- a/drivers/w1/slaves/w1_ds2438.c
+++ b/drivers/w1/slaves/w1_ds2438.c
@@ -62,13 +62,13 @@ static int w1_ds2438_get_page(struct w1_slave *sl, int pageno, u8 *buf)
if (w1_reset_select_slave(sl))
continue;
w1_buf[0] = W1_DS2438_RECALL_MEMORY;
- w1_buf[1] = 0x00;
+ w1_buf[1] = (u8)pageno;
w1_write_block(sl->master, w1_buf, 2);
if (w1_reset_select_slave(sl))
continue;
w1_buf[0] = W1_DS2438_READ_SCRATCH;
- w1_buf[1] = 0x00;
+ w1_buf[1] = (u8)pageno;
w1_write_block(sl->master, w1_buf, 2);
count = w1_read_block(sl->master, buf, DS2438_PAGE_SIZE + 1);