Skip to contentSkip to conversation

Input: cyttsp4 - SPI driver for Cypress TMA4XX touchscreen devices

DISCUSSION Geert Uytterhoeven 2 participants 2 messages Jul 7, 2013 – Jul 9, 2013 1 message not in the archive HID

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Review

Quoted 7 lines · Linux Kernel Mailing List

+++ b/drivers/input/touchscreen/cyttsp4_spi.c

(quoted diff) +4 -0
+static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
+                          u8 op, u8 reg, u8 *buf, int length)
+{
 
+       if (reg > 255)

As "reg" is "u8", this is never true:

drivers/input/touchscreen/cyttsp4_spi.c: In function ‘cyttsp_spi_xfer’:
drivers/input/touchscreen/cyttsp4_spi.c:66: warning: comparison is always false due to limited range of data type

Review

Quoted 3 lines
(quoted diff) +3 -0
+               wr_buf[0] = op + CY_SPI_A8_BIT;
+       else
+               wr_buf[0] = op;

Can the if-clause and the first branch just be removed, or is there a real bug involved (e.g. wrong type for "reg")?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
Quoted 16 lines · Geert Uytterhoeven

Review

Quoted 7 lines · Linux Kernel Mailing List

+++ b/drivers/input/touchscreen/cyttsp4_spi.c

(quoted diff) +4 -0
+static int cyttsp_spi_xfer(struct device *dev, u8 *xfer_buf,
+                          u8 op, u8 reg, u8 *buf, int length)
+{
 
+       if (reg > 255)

As "reg" is "u8", this is never true:

drivers/input/touchscreen/cyttsp4_spi.c: In function ‘cyttsp_spi_xfer’:
drivers/input/touchscreen/cyttsp4_spi.c:66: warning: comparison is always false due to limited range of data type

Quoted 6 lines

Review

Quoted 3 lines
(quoted diff) +3 -0
+               wr_buf[0] = op + CY_SPI_A8_BIT;
+       else
+               wr_buf[0] = op;

Can the if-clause and the first branch just be removed, or is there a real bug involved (e.g. wrong type for "reg")?

Yes there was a bug here, and already sent a patch for this, please check https://patchwork.kernel.org/patch/2820561/

thanks,
ferruh

This message and any attachments may contain Cypress (or its subsidiaries) confidential information. If it has been received in error, please advise the sender and immediately delete this message.