[PATCH] Restrict read pointer to 16 bit of tcpci_read16.

? ? incarnation.p.lee at outlook.com
Fri Jun 2 02:59:46 UTC 2017


From: Pan Li <incarnation.p.lee at outlook.com>

    Restricted tcpci_read16 arugment to 16 bit variable pointer,
in accord with the function name.

Signed-off-by: Pan Li <incarnation.p.lee at outlook.com>
---
 drivers/staging/typec/tcpci.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c
index 405c9cc..c62f4a2 100644
--- a/drivers/staging/typec/tcpci.c
+++ b/drivers/staging/typec/tcpci.c
@@ -46,8 +46,7 @@ static inline struct tcpci *tcpc_to_tcpci(struct tcpc_dev *tcpc)
 	return container_of(tcpc, struct tcpci, tcpc);
 }
 
-static int tcpci_read16(struct tcpci *tcpci, unsigned int reg,
-			unsigned int *val)
+static int tcpci_read16(struct tcpci *tcpci, unsigned int reg, u16 *val)
 {
 	return regmap_raw_read(tcpci->regmap, reg, val, sizeof(u16));
 }
@@ -355,7 +354,8 @@ static int tcpci_init(struct tcpc_dev *tcpc)
 static irqreturn_t tcpci_irq(int irq, void *dev_id)
 {
 	struct tcpci *tcpci = dev_id;
-	unsigned int status, reg;
+	unsigned int reg;
+	u16 header, status;
 
 	tcpci_read16(tcpci, TCPC_ALERT, &status);
 
@@ -389,8 +389,8 @@ static irqreturn_t tcpci_irq(int irq, void *dev_id)
 
 		regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt);
 
-		tcpci_read16(tcpci, TCPC_RX_HDR, &reg);
-		msg.header = reg;
+		tcpci_read16(tcpci, TCPC_RX_HDR, &header);
+		msg.header = header;
 
 		if (WARN_ON(cnt > sizeof(msg.payload)))
 			cnt = sizeof(msg.payload);
-- 
1.9.1



More information about the devel mailing list