* Re: [PATCH 3/3] staging: typec: Fix one defect of incorrect type assignment. [not found] ` <CY4PR16MB1669E1E3C1E89F3199057AA9B7F60@CY4PR16MB1669.namprd16.prod.outlook.com> @ 2017-06-01 14:52 ` Dan Carpenter 0 siblings, 0 replies; 5+ messages in thread From: Dan Carpenter @ 2017-06-01 14:52 UTC (permalink / raw) To: ? ?; +Cc: gregkh, linux, yueyao.zhu, devel, o_leveque, linux-kernel On Thu, Jun 01, 2017 at 07:21:38AM +0000, ? ? wrote: > From: Pan Li <incarnation.p.lee@outlook.com> > > Convert type cpu to le16 for consistent type assignment. > > Signed-off-by: Pan Li <incarnation.p.lee@outlook.com> > --- > drivers/staging/typec/tcpci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c > index 18d2e06..dac41f2 100644 > --- a/drivers/staging/typec/tcpci.c > +++ b/drivers/staging/typec/tcpci.c > @@ -390,7 +390,7 @@ 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, ®); > - msg.header = reg; > + msg.header = cpu_to_le16(reg); This looks like you introduced a bug. We surely read le values? Please be more careful. regards, dan carpenter ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CY4PR16MB1669D17AEAA092B236E59287B7F60@CY4PR16MB1669.namprd16.prod.outlook.com>]
* Re: [PATCH 1/3] staging: typec: Fix one defect of incorrect type in argument. [not found] ` <CY4PR16MB1669D17AEAA092B236E59287B7F60@CY4PR16MB1669.namprd16.prod.outlook.com> @ 2017-06-01 14:57 ` Dan Carpenter 2017-06-01 15:17 ` Guenter Roeck 0 siblings, 1 reply; 5+ messages in thread From: Dan Carpenter @ 2017-06-01 14:57 UTC (permalink / raw) To: ? ?; +Cc: gregkh, linux, yueyao.zhu, devel, o_leveque, linux-kernel On Thu, Jun 01, 2017 at 07:21:00AM +0000, ? ? wrote: > From: Pan Li <incarnation.p.lee@outlook.com> > > Convert type le16 to cpu of argument 1 in function pd_header_cnt. > > Signed-off-by: Pan Li <incarnation.p.lee@outlook.com> > --- > drivers/staging/typec/tcpci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c > index df72d8b..405c9cc 100644 > --- a/drivers/staging/typec/tcpci.c > +++ b/drivers/staging/typec/tcpci.c > @@ -287,7 +287,7 @@ static int tcpci_pd_transmit(struct tcpc_dev *tcpc, > unsigned int reg, cnt, header; > int ret; > > - cnt = msg ? pd_header_cnt(msg->header) * 4 : 0; > + cnt = msg ? pd_header_cnt(le16_to_cpu(msg->header)) * 4 : 0; I guess this one is probably correct... regards, dan carpenter ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] staging: typec: Fix one defect of incorrect type in argument. 2017-06-01 14:57 ` [PATCH 1/3] staging: typec: Fix one defect of incorrect type in argument Dan Carpenter @ 2017-06-01 15:17 ` Guenter Roeck 0 siblings, 0 replies; 5+ messages in thread From: Guenter Roeck @ 2017-06-01 15:17 UTC (permalink / raw) To: Dan Carpenter; +Cc: ? ?, gregkh, yueyao.zhu, devel, o_leveque, linux-kernel On Thu, Jun 01, 2017 at 05:57:14PM +0300, Dan Carpenter wrote: > On Thu, Jun 01, 2017 at 07:21:00AM +0000, ? ? wrote: > > From: Pan Li <incarnation.p.lee@outlook.com> > > > > Convert type le16 to cpu of argument 1 in function pd_header_cnt. > > > > Signed-off-by: Pan Li <incarnation.p.lee@outlook.com> > > --- > > drivers/staging/typec/tcpci.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c > > index df72d8b..405c9cc 100644 > > --- a/drivers/staging/typec/tcpci.c > > +++ b/drivers/staging/typec/tcpci.c > > @@ -287,7 +287,7 @@ static int tcpci_pd_transmit(struct tcpc_dev *tcpc, > > unsigned int reg, cnt, header; > > int ret; > > > > - cnt = msg ? pd_header_cnt(msg->header) * 4 : 0; > > + cnt = msg ? pd_header_cnt(le16_to_cpu(msg->header)) * 4 : 0; > > I guess this one is probably correct... > Yes. Overall though the series only touches the surface; the driver as-is is just not endianness clean. Someone will have to go through it and fix all problems. For example, tcpci_read16() is flawed since it reads 16 bits into a unrestricted 32 bit variable pointer. This needs some active work and can not rely on code analysis to find and fix the all flaws. Something to add to TODO. Side note: The subject lines in this series are all messed up. Thanks, Guenter ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CY4PR16MB1669BD8D774D46F2C837E905B7F60@CY4PR16MB1669.namprd16.prod.outlook.com>]
* Re: [PATCH 2/3] staging: typec: Fix one defect of incorrect type assignment. [not found] ` <CY4PR16MB1669BD8D774D46F2C837E905B7F60@CY4PR16MB1669.namprd16.prod.outlook.com> @ 2017-06-01 14:58 ` Dan Carpenter 0 siblings, 0 replies; 5+ messages in thread From: Dan Carpenter @ 2017-06-01 14:58 UTC (permalink / raw) To: ? ?; +Cc: gregkh, linux, yueyao.zhu, devel, o_leveque, linux-kernel On Thu, Jun 01, 2017 at 07:21:22AM +0000, ? ? wrote: > From: Pan Li <incarnation.p.lee@outlook.com> > > Convert type le16 to cpu for consistent type assignment. > > Signed-off-by: Pan Li <incarnation.p.lee@outlook.com> > --- > drivers/staging/typec/tcpci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c > index 405c9cc..18d2e06 100644 > --- a/drivers/staging/typec/tcpci.c > +++ b/drivers/staging/typec/tcpci.c > @@ -292,7 +292,7 @@ static int tcpci_pd_transmit(struct tcpc_dev *tcpc, > if (ret < 0) > return ret; > > - header = msg ? msg->header : 0; > + header = msg ? le16_to_cpu(msg->header) : 0; > ret = tcpci_write16(tcpci, TCPC_TX_HDR, header); This looks like it introduces bugs. We normally write endian data and you've changed it to write CPU endian data. regards, dan carpenter ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <CY4PR16MB166944C4A3ACC08A513059BBB7F60@CY4PR16MB1669.namprd16.prod.outlook.com>]
* Re: [PATCH 0/3] staging:typec: Fix 3 defect of incorrect type [not found] ` <CY4PR16MB166944C4A3ACC08A513059BBB7F60@CY4PR16MB1669.namprd16.prod.outlook.com> @ 2017-06-02 13:45 ` Guenter Roeck 0 siblings, 0 replies; 5+ messages in thread From: Guenter Roeck @ 2017-06-02 13:45 UTC (permalink / raw) To: ? ?, gregkh, yueyao.zhu; +Cc: rmfrfs, o_leveque, devel, linux-kernel On 06/01/2017 12:20 AM, ? ? wrote: > From: Pan Li <incarnation.p.lee@outlook.com> > > Pan Li (3): > Fix one defect of incorrect type in argument. > Fix one defect of incorrect type assignment. > Fix one defect of incorrect type assignment. > > drivers/staging/typec/tcpci.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > Please merge those patches into one. They all fix endianness issues. Thanks, Guenter ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-02 13:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <Task-16>
[not found] ` <CY4PR16MB1669E1E3C1E89F3199057AA9B7F60@CY4PR16MB1669.namprd16.prod.outlook.com>
2017-06-01 14:52 ` [PATCH 3/3] staging: typec: Fix one defect of incorrect type assignment Dan Carpenter
[not found] ` <CY4PR16MB1669D17AEAA092B236E59287B7F60@CY4PR16MB1669.namprd16.prod.outlook.com>
2017-06-01 14:57 ` [PATCH 1/3] staging: typec: Fix one defect of incorrect type in argument Dan Carpenter
2017-06-01 15:17 ` Guenter Roeck
[not found] ` <CY4PR16MB1669BD8D774D46F2C837E905B7F60@CY4PR16MB1669.namprd16.prod.outlook.com>
2017-06-01 14:58 ` [PATCH 2/3] staging: typec: Fix one defect of incorrect type assignment Dan Carpenter
[not found] ` <CY4PR16MB166944C4A3ACC08A513059BBB7F60@CY4PR16MB1669.namprd16.prod.outlook.com>
2017-06-02 13:45 ` [PATCH 0/3] staging:typec: Fix 3 defect of incorrect type Guenter Roeck
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome