linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift()
@ 2018-06-04 11:58 Dan Carpenter
  2018-06-04 12:06 ` Mathieu Malaterre
  2018-06-04 13:25 ` Julia Lawall
  0 siblings, 2 replies; 7+ messages in thread
From: Dan Carpenter @ 2018-06-04 11:58 UTC (permalink / raw)
  To: Qiang Zhao; +Cc: Li Yang, linuxppc-dev, linux-kernel, kernel-janitors

There is a copy and paste bug so we accidentally use the RX_ shift when
we're in TX_ mode.

Fixes: bb8b2062aff3 ("fsl/qe: setup clock source for TDM mode")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis work.  Not tested.  This affects the success path, so
we should probably test it.

diff --git a/drivers/soc/fsl/qe/ucc.c b/drivers/soc/fsl/qe/ucc.c
index c646d8713861..681f7d4b7724 100644
--- a/drivers/soc/fsl/qe/ucc.c
+++ b/drivers/soc/fsl/qe/ucc.c
@@ -626,7 +626,7 @@ static u32 ucc_get_tdm_sync_shift(enum comm_dir mode, u32 tdm_num)
 {
 	u32 shift;
 
-	shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : RX_SYNC_SHIFT_BASE;
+	shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : TX_SYNC_SHIFT_BASE;
 	shift -= tdm_num * 2;
 
 	return shift;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift()
  2018-06-04 11:58 [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift() Dan Carpenter
@ 2018-06-04 12:06 ` Mathieu Malaterre
  2018-08-29  9:39   ` Dan Carpenter
  2018-06-04 13:25 ` Julia Lawall
  1 sibling, 1 reply; 7+ messages in thread
From: Mathieu Malaterre @ 2018-06-04 12:06 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: qiang.zhao, kernel-janitors, linuxppc-dev, LKML, leoyang.li

Where did the original go ?

https://patchwork.ozlabs.org/patch/868158/


On Mon, Jun 4, 2018 at 2:02 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> There is a copy and paste bug so we accidentally use the RX_ shift when
> we're in TX_ mode.
>
> Fixes: bb8b2062aff3 ("fsl/qe: setup clock source for TDM mode")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static analysis work.  Not tested.  This affects the success path, so
> we should probably test it.
>
> diff --git a/drivers/soc/fsl/qe/ucc.c b/drivers/soc/fsl/qe/ucc.c
> index c646d8713861..681f7d4b7724 100644
> --- a/drivers/soc/fsl/qe/ucc.c
> +++ b/drivers/soc/fsl/qe/ucc.c
> @@ -626,7 +626,7 @@ static u32 ucc_get_tdm_sync_shift(enum comm_dir mode, u32 tdm_num)
>  {
>         u32 shift;
>
> -       shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : RX_SYNC_SHIFT_BASE;
> +       shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : TX_SYNC_SHIFT_BASE;
>         shift -= tdm_num * 2;
>
>         return shift;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift()
  2018-06-04 11:58 [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift() Dan Carpenter
  2018-06-04 12:06 ` Mathieu Malaterre
@ 2018-06-04 13:25 ` Julia Lawall
  2018-06-04 13:40   ` Dan Carpenter
  1 sibling, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2018-06-04 13:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Qiang Zhao, Li Yang, linuxppc-dev, linux-kernel, kernel-janitors



On Mon, 4 Jun 2018, Dan Carpenter wrote:

> There is a copy and paste bug so we accidentally use the RX_ shift when
> we're in TX_ mode.
>
> Fixes: bb8b2062aff3 ("fsl/qe: setup clock source for TDM mode")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static analysis work.  Not tested.  This affects the success path, so
> we should probably test it.

Maybe this is another one?  I don't have time to look into it at the
moment...

drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c

 	/* For strict priority entries defines the number of consecutive
 	 * slots for the highest priority.
 	 */
	REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS :
		   NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS, 0x100);
 	/* Mapping between the CREDIT_WEIGHT registers and actual client
 	 * numbers
 	 */

I find some others that choose between constants, such as ... ? 0 : 0.

julia


>
> diff --git a/drivers/soc/fsl/qe/ucc.c b/drivers/soc/fsl/qe/ucc.c
> index c646d8713861..681f7d4b7724 100644
> --- a/drivers/soc/fsl/qe/ucc.c
> +++ b/drivers/soc/fsl/qe/ucc.c
> @@ -626,7 +626,7 @@ static u32 ucc_get_tdm_sync_shift(enum comm_dir mode, u32 tdm_num)
>  {
>  	u32 shift;
>
> -	shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : RX_SYNC_SHIFT_BASE;
> +	shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : TX_SYNC_SHIFT_BASE;
>  	shift -= tdm_num * 2;
>
>  	return shift;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift()
  2018-06-04 13:25 ` Julia Lawall
@ 2018-06-04 13:40   ` Dan Carpenter
  2018-06-04 13:46     ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2018-06-04 13:40 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Qiang Zhao, Li Yang, linuxppc-dev, linux-kernel, kernel-janitors

On Mon, Jun 04, 2018 at 10:25:14PM +0900, Julia Lawall wrote:
> 
> 
> On Mon, 4 Jun 2018, Dan Carpenter wrote:
> 
> > There is a copy and paste bug so we accidentally use the RX_ shift when
> > we're in TX_ mode.
> >
> > Fixes: bb8b2062aff3 ("fsl/qe: setup clock source for TDM mode")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > Static analysis work.  Not tested.  This affects the success path, so
> > we should probably test it.
> 
> Maybe this is another one?  I don't have time to look into it at the
> moment...
> 
> drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
> 
>  	/* For strict priority entries defines the number of consecutive
>  	 * slots for the highest priority.
>  	 */
> 	REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS :
> 		   NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS, 0x100);
>  	/* Mapping between the CREDIT_WEIGHT registers and actual client
>  	 * numbers
>  	 */
> 
> I find some others that choose between constants, such as ... ? 0 : 0.

I feel like it should warn about all of those because people shouldn't
be submitting unfinished written code to the kernel.  Coccinelle is a
lot better for this than Smatch is because it's pre-processor stuff.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift()
  2018-06-04 13:40   ` Dan Carpenter
@ 2018-06-04 13:46     ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2018-06-04 13:46 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Qiang Zhao, Li Yang, linuxppc-dev, linux-kernel, kernel-janitors



On Mon, 4 Jun 2018, Dan Carpenter wrote:

> On Mon, Jun 04, 2018 at 10:25:14PM +0900, Julia Lawall wrote:
> >
> >
> > On Mon, 4 Jun 2018, Dan Carpenter wrote:
> >
> > > There is a copy and paste bug so we accidentally use the RX_ shift when
> > > we're in TX_ mode.
> > >
> > > Fixes: bb8b2062aff3 ("fsl/qe: setup clock source for TDM mode")
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > ---
> > > Static analysis work.  Not tested.  This affects the success path, so
> > > we should probably test it.
> >
> > Maybe this is another one?  I don't have time to look into it at the
> > moment...
> >
> > drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
> >
> >  	/* For strict priority entries defines the number of consecutive
> >  	 * slots for the highest priority.
> >  	 */
> > 	REG_WR(bp, (port) ? NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS :
> > 		   NIG_REG_P1_TX_ARB_NUM_STRICT_ARB_SLOTS, 0x100);
> >  	/* Mapping between the CREDIT_WEIGHT registers and actual client
> >  	 * numbers
> >  	 */
> >
> > I find some others that choose between constants, such as ... ? 0 : 0.
>
> I feel like it should warn about all of those because people shouldn't
> be submitting unfinished written code to the kernel.  Coccinelle is a
> lot better for this than Smatch is because it's pre-processor stuff.

OK, maybe I can report these in the next few days.

thanks,
julia

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift()
  2018-06-04 12:06 ` Mathieu Malaterre
@ 2018-08-29  9:39   ` Dan Carpenter
  2018-08-29 22:41     ` Li Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2018-08-29  9:39 UTC (permalink / raw)
  To: Mathieu Malaterre
  Cc: qiang.zhao, kernel-janitors, linuxppc-dev, LKML, leoyang.li

On Mon, Jun 04, 2018 at 02:06:45PM +0200, Mathieu Malaterre wrote:
> Where did the original go ?
> 
> https://patchwork.ozlabs.org/patch/868158/
> 
> 

Btw, we still haven't pushed a patch for this bug.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift()
  2018-08-29  9:39   ` Dan Carpenter
@ 2018-08-29 22:41     ` Li Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Li Yang @ 2018-08-29 22:41 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: malat, linuxppc-dev, kernel-janitors, lkml, Zhao Qiang

On Wed, Aug 29, 2018 at 4:42 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> On Mon, Jun 04, 2018 at 02:06:45PM +0200, Mathieu Malaterre wrote:
> > Where did the original go ?
> >
> > https://patchwork.ozlabs.org/patch/868158/
> >
> >
>
> Btw, we still haven't pushed a patch for this bug.

I will combine Zhao Qiang's patch with your description which is
better, and push as fix for 4.19.

Regards,
Leo

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-08-29 22:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-04 11:58 [PATCH] fsl/qe: ucc: copy and paste bug in ucc_get_tdm_sync_shift() Dan Carpenter
2018-06-04 12:06 ` Mathieu Malaterre
2018-08-29  9:39   ` Dan Carpenter
2018-08-29 22:41     ` Li Yang
2018-06-04 13:25 ` Julia Lawall
2018-06-04 13:40   ` Dan Carpenter
2018-06-04 13:46     ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).