From 19226502bf6393706defe7f049c587b32c9b4f33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Wed, 31 Jul 2019 18:23:26 +0200 Subject: brcm2708: update to latest patches from the RPi foundation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Álvaro Fernández Rojas --- ...0675-w1-ds2413-fix-state-byte-comparision.patch | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 target/linux/brcm2708/patches-4.19/950-0675-w1-ds2413-fix-state-byte-comparision.patch (limited to 'target/linux/brcm2708/patches-4.19/950-0675-w1-ds2413-fix-state-byte-comparision.patch') diff --git a/target/linux/brcm2708/patches-4.19/950-0675-w1-ds2413-fix-state-byte-comparision.patch b/target/linux/brcm2708/patches-4.19/950-0675-w1-ds2413-fix-state-byte-comparision.patch new file mode 100644 index 0000000000..bf868cd089 --- /dev/null +++ b/target/linux/brcm2708/patches-4.19/950-0675-w1-ds2413-fix-state-byte-comparision.patch @@ -0,0 +1,48 @@ +From 8604b2fb9843248b9bc792c52393cb05b7a29836 Mon Sep 17 00:00:00 2001 +From: Mariusz Bialonczyk +Date: Thu, 30 May 2019 09:51:25 +0200 +Subject: [PATCH 675/725] w1: ds2413: fix state byte comparision + +commit aacd152ecd7b18af5d2d96dea9e7284c1c93abea upstream. + +This commit is fixing a smatch warning: +drivers/w1/slaves/w1_ds2413.c:61 state_read() warn: impossible condition '(*buf == 255) => ((-128)-127 == 255)' +by creating additional u8 variable for the bus reading and comparision + +Reported-by: kbuild test robot +Reported-by: Dan Carpenter +Cc: Dan Carpenter +Fixes: 3856032a0628 ("w1: ds2413: when the slave is not responding during read, select it again") +Signed-off-by: Mariusz Bialonczyk +Signed-off-by: Greg Kroah-Hartman +--- + drivers/w1/slaves/w1_ds2413.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +--- a/drivers/w1/slaves/w1_ds2413.c ++++ b/drivers/w1/slaves/w1_ds2413.c +@@ -33,6 +33,7 @@ static ssize_t state_read(struct file *f + struct w1_slave *sl = kobj_to_w1_slave(kobj); + unsigned int retries = W1_F3A_RETRIES; + ssize_t bytes_read = -EIO; ++ u8 state; + + dev_dbg(&sl->dev, + "Reading %s kobj: %p, off: %0#10x, count: %zu, buff addr: %p", +@@ -53,12 +54,13 @@ next: + while (retries--) { + w1_write_8(sl->master, W1_F3A_FUNC_PIO_ACCESS_READ); + +- *buf = w1_read_8(sl->master); +- if ((*buf & 0x0F) == ((~*buf >> 4) & 0x0F)) { ++ state = w1_read_8(sl->master); ++ if ((state & 0x0F) == ((~state >> 4) & 0x0F)) { + /* complement is correct */ ++ *buf = state; + bytes_read = 1; + goto out; +- } else if (*buf == W1_F3A_INVALID_PIO_STATE) { ++ } else if (state == W1_F3A_INVALID_PIO_STATE) { + /* slave didn't respond, try to select it again */ + dev_warn(&sl->dev, "slave device did not respond to PIO_ACCESS_READ, " \ + "reselecting, retries left: %d\n", retries); -- cgit v1.2.3