* [PATCH] staging: vt6655: Remove useless else @ 2020-10-29 6:59 Marcos Antonio de Jesus Filho 2020-10-29 7:07 ` Greg Kroah-Hartman 0 siblings, 1 reply; 5+ messages in thread From: Marcos Antonio de Jesus Filho @ 2020-10-29 6:59 UTC (permalink / raw) To: Forest Bond, Greg Kroah-Hartman, outreachy-kernel The else statement is not useful due to the presence of a return statement on the if block. Remove the else statement and adjust the indentation of the code. Reported by checkpatch. Signed-off-by: Marcos Antonio de Jesus Filho <mdejesusfilho@gmail.com> --- drivers/staging/vt6655/rxtx.c | 36 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 477d19314634..978efe81077a 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -519,28 +519,28 @@ s_uFillDataHead( wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); return buf->duration; - } else { - struct vnt_tx_datahead_ab *buf = pTxDataHead; - /* Get SignalField, ServiceField & Length */ - vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, - byPktType, &buf->ab); + } - if (is_pspoll) { - __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); + struct vnt_tx_datahead_ab *buf = pTxDataHead; + /* Get SignalField, ServiceField & Length */ + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, + byPktType, &buf->ab); - buf->duration = dur; - } else { - /* Get Duration and TimeStampOff */ - buf->duration = - cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, - wCurrentRate, bNeedAck, uFragIdx, - cbLastFragmentSize, uMACfragNum, - byFBOption)); - } + if (is_pspoll) { + __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); - buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); - return buf->duration; + buf->duration = dur; + } else { + /* Get Duration and TimeStampOff */ + buf->duration = + cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, + wCurrentRate, bNeedAck, uFragIdx, + cbLastFragmentSize, uMACfragNum, + byFBOption)); } + + buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); + return buf->duration; } else { struct vnt_tx_datahead_ab *buf = pTxDataHead; /* Get SignalField, ServiceField & Length */ -- 2.28.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: vt6655: Remove useless else 2020-10-29 6:59 [PATCH] staging: vt6655: Remove useless else Marcos Antonio de Jesus Filho @ 2020-10-29 7:07 ` Greg Kroah-Hartman 2020-10-29 8:09 ` Marcos Antonio de Jesus Filho 0 siblings, 1 reply; 5+ messages in thread From: Greg Kroah-Hartman @ 2020-10-29 7:07 UTC (permalink / raw) To: Marcos Antonio de Jesus Filho; +Cc: Forest Bond, outreachy-kernel On Wed, Oct 28, 2020 at 11:59:58PM -0700, Marcos Antonio de Jesus Filho wrote: > The else statement is not useful due to the presence of a return > statement on the if block. Remove the else statement and adjust the > indentation of the code. Reported by checkpatch. > > Signed-off-by: Marcos Antonio de Jesus Filho <mdejesusfilho@gmail.com> > --- > drivers/staging/vt6655/rxtx.c | 36 +++++++++++++++++------------------ > 1 file changed, 18 insertions(+), 18 deletions(-) > > diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c > index 477d19314634..978efe81077a 100644 > --- a/drivers/staging/vt6655/rxtx.c > +++ b/drivers/staging/vt6655/rxtx.c > @@ -519,28 +519,28 @@ s_uFillDataHead( > wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); > buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > return buf->duration; > - } else { > - struct vnt_tx_datahead_ab *buf = pTxDataHead; > - /* Get SignalField, ServiceField & Length */ > - vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, > - byPktType, &buf->ab); > + } > > - if (is_pspoll) { > - __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); > + struct vnt_tx_datahead_ab *buf = pTxDataHead; > + /* Get SignalField, ServiceField & Length */ > + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, > + byPktType, &buf->ab); > > - buf->duration = dur; > - } else { > - /* Get Duration and TimeStampOff */ > - buf->duration = > - cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, > - wCurrentRate, bNeedAck, uFragIdx, > - cbLastFragmentSize, uMACfragNum, > - byFBOption)); > - } > + if (is_pspoll) { > + __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); > > - buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > - return buf->duration; > + buf->duration = dur; > + } else { > + /* Get Duration and TimeStampOff */ > + buf->duration = > + cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, > + wCurrentRate, bNeedAck, uFragIdx, > + cbLastFragmentSize, uMACfragNum, > + byFBOption)); > } > + > + buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > + return buf->duration; > } else { You do the same thing here, right? Shouldn't this else be dropped? thanks, greg k-h ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: vt6655: Remove useless else 2020-10-29 7:07 ` Greg Kroah-Hartman @ 2020-10-29 8:09 ` Marcos Antonio de Jesus Filho 2020-10-30 6:12 ` Marcos Antonio de Jesus Filho 0 siblings, 1 reply; 5+ messages in thread From: Marcos Antonio de Jesus Filho @ 2020-10-29 8:09 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: Forest Bond, outreachy-kernel On Thu, Oct 29, 2020 at 08:07:23AM +0100, Greg Kroah-Hartman wrote: > On Wed, Oct 28, 2020 at 11:59:58PM -0700, Marcos Antonio de Jesus Filho wrote: > > The else statement is not useful due to the presence of a return > > statement on the if block. Remove the else statement and adjust the > > indentation of the code. Reported by checkpatch. > > > > Signed-off-by: Marcos Antonio de Jesus Filho <mdejesusfilho@gmail.com> > > --- > > drivers/staging/vt6655/rxtx.c | 36 +++++++++++++++++------------------ > > 1 file changed, 18 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c > > index 477d19314634..978efe81077a 100644 > > --- a/drivers/staging/vt6655/rxtx.c > > +++ b/drivers/staging/vt6655/rxtx.c > > @@ -519,28 +519,28 @@ s_uFillDataHead( > > wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); > > buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > return buf->duration; > > - } else { > > - struct vnt_tx_datahead_ab *buf = pTxDataHead; > > - /* Get SignalField, ServiceField & Length */ > > - vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, > > - byPktType, &buf->ab); > > + } > > > > - if (is_pspoll) { > > - __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); > > + struct vnt_tx_datahead_ab *buf = pTxDataHead; > > + /* Get SignalField, ServiceField & Length */ > > + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, > > + byPktType, &buf->ab); > > > > - buf->duration = dur; > > - } else { > > - /* Get Duration and TimeStampOff */ > > - buf->duration = > > - cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, > > - wCurrentRate, bNeedAck, uFragIdx, > > - cbLastFragmentSize, uMACfragNum, > > - byFBOption)); > > - } > > + if (is_pspoll) { > > + __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); > > > > - buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > - return buf->duration; > > + buf->duration = dur; > > + } else { > > + /* Get Duration and TimeStampOff */ > > + buf->duration = > > + cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, > > + wCurrentRate, bNeedAck, uFragIdx, > > + cbLastFragmentSize, uMACfragNum, > > + byFBOption)); > > } > > + > > + buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > + return buf->duration; > > } else { > > You do the same thing here, right? Shouldn't this else be dropped? Definitely. I did not do it because we are instructed to solve one 'Warning' at time. I was going to do it in another patch. Should I edit this patch and fix it now? > > thanks, > > greg k-h ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: vt6655: Remove useless else 2020-10-29 8:09 ` Marcos Antonio de Jesus Filho @ 2020-10-30 6:12 ` Marcos Antonio de Jesus Filho 2020-10-30 7:12 ` Greg Kroah-Hartman 0 siblings, 1 reply; 5+ messages in thread From: Marcos Antonio de Jesus Filho @ 2020-10-30 6:12 UTC (permalink / raw) To: Greg Kroah-Hartman; +Cc: Forest Bond, outreachy-kernel On Thu, Oct 29, 2020 at 01:09:45AM -0700, Marcos Antonio de Jesus Filho wrote: > On Thu, Oct 29, 2020 at 08:07:23AM +0100, Greg Kroah-Hartman wrote: > > On Wed, Oct 28, 2020 at 11:59:58PM -0700, Marcos Antonio de Jesus Filho wrote: > > > The else statement is not useful due to the presence of a return > > > statement on the if block. Remove the else statement and adjust the > > > indentation of the code. Reported by checkpatch. > > > > > > Signed-off-by: Marcos Antonio de Jesus Filho <mdejesusfilho@gmail.com> > > > --- > > > drivers/staging/vt6655/rxtx.c | 36 +++++++++++++++++------------------ > > > 1 file changed, 18 insertions(+), 18 deletions(-) > > > > > > diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c > > > index 477d19314634..978efe81077a 100644 > > > --- a/drivers/staging/vt6655/rxtx.c > > > +++ b/drivers/staging/vt6655/rxtx.c > > > @@ -519,28 +519,28 @@ s_uFillDataHead( > > > wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); > > > buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > > return buf->duration; > > > - } else { > > > - struct vnt_tx_datahead_ab *buf = pTxDataHead; > > > - /* Get SignalField, ServiceField & Length */ > > > - vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, > > > - byPktType, &buf->ab); > > > + } > > > > > > - if (is_pspoll) { > > > - __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); > > > + struct vnt_tx_datahead_ab *buf = pTxDataHead; > > > + /* Get SignalField, ServiceField & Length */ > > > + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, > > > + byPktType, &buf->ab); > > > > > > - buf->duration = dur; > > > - } else { > > > - /* Get Duration and TimeStampOff */ > > > - buf->duration = > > > - cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, > > > - wCurrentRate, bNeedAck, uFragIdx, > > > - cbLastFragmentSize, uMACfragNum, > > > - byFBOption)); > > > - } > > > + if (is_pspoll) { > > > + __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); > > > > > > - buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > > - return buf->duration; > > > + buf->duration = dur; > > > + } else { > > > + /* Get Duration and TimeStampOff */ > > > + buf->duration = > > > + cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, > > > + wCurrentRate, bNeedAck, uFragIdx, > > > + cbLastFragmentSize, uMACfragNum, > > > + byFBOption)); > > > } > > > + > > > + buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > > + return buf->duration; > > > } else { > > > > You do the same thing here, right? Shouldn't this else be dropped? > > Definitely. I did not do it because we are instructed to solve one 'Warning' at time. I was going to do it in another patch. > Should I edit this patch and fix it now? > > > > > thanks, > > > > greg k-h I notice that after removing the else statement I get the compilation error "ISO C90 forbids mixed declarations and code", because we eliminate the scope of the else block. Should I leave as it is? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] staging: vt6655: Remove useless else 2020-10-30 6:12 ` Marcos Antonio de Jesus Filho @ 2020-10-30 7:12 ` Greg Kroah-Hartman 0 siblings, 0 replies; 5+ messages in thread From: Greg Kroah-Hartman @ 2020-10-30 7:12 UTC (permalink / raw) To: Marcos Antonio de Jesus Filho; +Cc: Forest Bond, outreachy-kernel On Thu, Oct 29, 2020 at 11:12:29PM -0700, Marcos Antonio de Jesus Filho wrote: > On Thu, Oct 29, 2020 at 01:09:45AM -0700, Marcos Antonio de Jesus Filho wrote: > > On Thu, Oct 29, 2020 at 08:07:23AM +0100, Greg Kroah-Hartman wrote: > > > On Wed, Oct 28, 2020 at 11:59:58PM -0700, Marcos Antonio de Jesus Filho wrote: > > > > The else statement is not useful due to the presence of a return > > > > statement on the if block. Remove the else statement and adjust the > > > > indentation of the code. Reported by checkpatch. > > > > > > > > Signed-off-by: Marcos Antonio de Jesus Filho <mdejesusfilho@gmail.com> > > > > --- > > > > drivers/staging/vt6655/rxtx.c | 36 +++++++++++++++++------------------ > > > > 1 file changed, 18 insertions(+), 18 deletions(-) > > > > > > > > diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c > > > > index 477d19314634..978efe81077a 100644 > > > > --- a/drivers/staging/vt6655/rxtx.c > > > > +++ b/drivers/staging/vt6655/rxtx.c > > > > @@ -519,28 +519,28 @@ s_uFillDataHead( > > > > wCurrentRate, bNeedAck, uFragIdx, cbLastFragmentSize, uMACfragNum, byFBOption)); > > > > buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > > > return buf->duration; > > > > - } else { > > > > - struct vnt_tx_datahead_ab *buf = pTxDataHead; > > > > - /* Get SignalField, ServiceField & Length */ > > > > - vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, > > > > - byPktType, &buf->ab); > > > > + } > > > > > > > > - if (is_pspoll) { > > > > - __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); > > > > + struct vnt_tx_datahead_ab *buf = pTxDataHead; > > > > + /* Get SignalField, ServiceField & Length */ > > > > + vnt_get_phy_field(pDevice, cbFrameLength, wCurrentRate, > > > > + byPktType, &buf->ab); > > > > > > > > - buf->duration = dur; > > > > - } else { > > > > - /* Get Duration and TimeStampOff */ > > > > - buf->duration = > > > > - cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, > > > > - wCurrentRate, bNeedAck, uFragIdx, > > > > - cbLastFragmentSize, uMACfragNum, > > > > - byFBOption)); > > > > - } > > > > + if (is_pspoll) { > > > > + __le16 dur = cpu_to_le16(pDevice->current_aid | BIT(14) | BIT(15)); > > > > > > > > - buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > > > - return buf->duration; > > > > + buf->duration = dur; > > > > + } else { > > > > + /* Get Duration and TimeStampOff */ > > > > + buf->duration = > > > > + cpu_to_le16((u16)s_uGetDataDuration(pDevice, DATADUR_A, cbFrameLength, byPktType, > > > > + wCurrentRate, bNeedAck, uFragIdx, > > > > + cbLastFragmentSize, uMACfragNum, > > > > + byFBOption)); > > > > } > > > > + > > > > + buf->time_stamp_off = vnt_time_stamp_off(pDevice, wCurrentRate); > > > > + return buf->duration; > > > > } else { > > > > > > You do the same thing here, right? Shouldn't this else be dropped? > > > > Definitely. I did not do it because we are instructed to solve one 'Warning' at time. I was going to do it in another patch. > > Should I edit this patch and fix it now? > > > > > > > > thanks, > > > > > > greg k-h > > I notice that after removing the else statement I get the compilation error "ISO C90 forbids mixed declarations and code", because we eliminate the scope of the else block. Should I leave as it is? You can not add build warnings to the kernel, so fix this up in a patch series where you do one step at a time, and keep everything building properly at each patch. thanks, greg k-h ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-30 7:11 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-10-29 6:59 [PATCH] staging: vt6655: Remove useless else Marcos Antonio de Jesus Filho 2020-10-29 7:07 ` Greg Kroah-Hartman 2020-10-29 8:09 ` Marcos Antonio de Jesus Filho 2020-10-30 6:12 ` Marcos Antonio de Jesus Filho 2020-10-30 7:12 ` Greg Kroah-Hartman
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.