Re: [PATCH 3/4] staging: rtl8712: Make error handling check for failure
On Wed, Nov 25, 2015 at 01:04:14PM -0200, Mauro Dreissig wrote: > On 25-11-2015 12:56, Mauro Dreissig wrote: > > On 25-11-2015 09:44, Sudip Mukherjee wrote: > >> On Tue, Nov 24, 2015 at 10:19:41AM -0200, Mauro Dreissig wrote: > >>> Some error handling paths are checking for success > >>> instead of error on rtl871x_ioctl_rtl.c. > >>> > >>> Signed-off-by: Mauro Dreissig> >>> --- > >>> drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 > >>> ++-- > >>> 1 file changed, 121 insertions(+), 118 deletions(-) > >>> > >> > >>> @@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv > >>> *poid_par_priv) > >>> > >>> if (poid_par_priv->type_of_oid != QUERY_OID) > >>> return RNDIS_STATUS_NOT_ACCEPTED; > >>> - if (poid_par_priv->information_buf_len >= sizeof(u32)) { > >>> - *(uint *)poid_par_priv->information_buf = > >>> - adapter->recvpriv.rx_icv_err; > >>> - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; > >>> - } else { > >>> + > >>> + if (poid_par_priv->information_buf_len < sizeof(u32)) > >> > >> trailing whitespace here. > >> Please always test your patch with checkpatch. > >> > >> regards > >> sudip > >> > > This blank line is intentional, there is no trailing whitespace. > > > > thanks, > > Mauro > > > My mistake, seems like I fixed it in the other patch in the series. Which isn't ok, please fix up the series and resend. thanks, greg k-h
Re: [PATCH 3/4] staging: rtl8712: Make error handling check for failure
On 25-11-2015 09:44, Sudip Mukherjee wrote: > On Tue, Nov 24, 2015 at 10:19:41AM -0200, Mauro Dreissig wrote: >> Some error handling paths are checking for success >> instead of error on rtl871x_ioctl_rtl.c. >> >> Signed-off-by: Mauro Dreissig>> --- >> drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 >> ++-- >> 1 file changed, 121 insertions(+), 118 deletions(-) >> > >> @@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv >> *poid_par_priv) >> >> if (poid_par_priv->type_of_oid != QUERY_OID) >> return RNDIS_STATUS_NOT_ACCEPTED; >> -if (poid_par_priv->information_buf_len >= sizeof(u32)) { >> -*(uint *)poid_par_priv->information_buf = >> - adapter->recvpriv.rx_icv_err; >> -*poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; >> -} else { >> + >> +if (poid_par_priv->information_buf_len < sizeof(u32)) > > trailing whitespace here. > Please always test your patch with checkpatch. > > regards > sudip > This blank line is intentional, there is no trailing whitespace. thanks, Mauro -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] staging: rtl8712: Make error handling check for failure
On 25-11-2015 12:56, Mauro Dreissig wrote: > On 25-11-2015 09:44, Sudip Mukherjee wrote: >> On Tue, Nov 24, 2015 at 10:19:41AM -0200, Mauro Dreissig wrote: >>> Some error handling paths are checking for success >>> instead of error on rtl871x_ioctl_rtl.c. >>> >>> Signed-off-by: Mauro Dreissig>>> --- >>> drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 >>> ++-- >>> 1 file changed, 121 insertions(+), 118 deletions(-) >>> >> >>> @@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv >>> *poid_par_priv) >>> >>> if (poid_par_priv->type_of_oid != QUERY_OID) >>> return RNDIS_STATUS_NOT_ACCEPTED; >>> - if (poid_par_priv->information_buf_len >= sizeof(u32)) { >>> - *(uint *)poid_par_priv->information_buf = >>> -adapter->recvpriv.rx_icv_err; >>> - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; >>> - } else { >>> + >>> + if (poid_par_priv->information_buf_len < sizeof(u32)) >> >> trailing whitespace here. >> Please always test your patch with checkpatch. >> >> regards >> sudip >> > This blank line is intentional, there is no trailing whitespace. > > thanks, > Mauro > My mistake, seems like I fixed it in the other patch in the series. thanks, Mauro -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] staging: rtl8712: Make error handling check for failure
On Tue, Nov 24, 2015 at 10:19:41AM -0200, Mauro Dreissig wrote: > Some error handling paths are checking for success > instead of error on rtl871x_ioctl_rtl.c. > > Signed-off-by: Mauro Dreissig> --- > drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 > ++-- > 1 file changed, 121 insertions(+), 118 deletions(-) > > @@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv > *poid_par_priv) > > if (poid_par_priv->type_of_oid != QUERY_OID) > return RNDIS_STATUS_NOT_ACCEPTED; > - if (poid_par_priv->information_buf_len >= sizeof(u32)) { > - *(uint *)poid_par_priv->information_buf = > - adapter->recvpriv.rx_icv_err; > - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; > - } else { > + > + if (poid_par_priv->information_buf_len < sizeof(u32)) trailing whitespace here. Please always test your patch with checkpatch. regards sudip -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/4] staging: rtl8712: Make error handling check for failure
Some error handling paths are checking for success instead of error on rtl871x_ioctl_rtl.c. Signed-off-by: Mauro Dreissig--- drivers/staging/rtl8712/rtl871x_ioctl_rtl.c | 239 ++-- 1 file changed, 121 insertions(+), 118 deletions(-) diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c index 97596aa..9317370 100644 --- a/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c +++ b/drivers/staging/rtl8712/rtl871x_ioctl_rtl.c @@ -53,13 +53,13 @@ uint oid_rt_get_small_packet_crc_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; - if (poid_par_priv->information_buf_len >= sizeof(u32)) { - *(u32 *)poid_par_priv->information_buf = - adapter->recvpriv.rx_smallpacket_crcerr; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else { + + if (poid_par_priv->information_buf_len < sizeof(u32)) return RNDIS_STATUS_INVALID_LENGTH; - } + + *(u32 *)poid_par_priv->information_buf = adapter->recvpriv.rx_smallpacket_crcerr; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + return RNDIS_STATUS_SUCCESS; } @@ -69,13 +69,13 @@ uint oid_rt_get_middle_packet_crc_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; - if (poid_par_priv->information_buf_len >= sizeof(u32)) { - *(u32 *)poid_par_priv->information_buf = - adapter->recvpriv.rx_middlepacket_crcerr; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else { + + if (poid_par_priv->information_buf_len < sizeof(u32)) return RNDIS_STATUS_INVALID_LENGTH; - } + + *(u32 *)poid_par_priv->information_buf = adapter->recvpriv.rx_middlepacket_crcerr; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + return RNDIS_STATUS_SUCCESS; } @@ -85,13 +85,13 @@ uint oid_rt_get_large_packet_crc_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; - if (poid_par_priv->information_buf_len >= sizeof(u32)) { - *(u32 *)poid_par_priv->information_buf = -adapter->recvpriv.rx_largepacket_crcerr; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else { + + if (poid_par_priv->information_buf_len < sizeof(u32)) return RNDIS_STATUS_INVALID_LENGTH; - } + + *(u32 *)poid_par_priv->information_buf = adapter->recvpriv.rx_largepacket_crcerr; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + return RNDIS_STATUS_SUCCESS; } @@ -116,14 +116,14 @@ uint oid_rt_get_rx_total_packet_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; - if (poid_par_priv->information_buf_len >= sizeof(u32)) { - *(u32 *)poid_par_priv->information_buf = -adapter->recvpriv.rx_pkts + -adapter->recvpriv.rx_drop; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else { + + if (poid_par_priv->information_buf_len < sizeof(u32)) return RNDIS_STATUS_INVALID_LENGTH; - } + + *(u32 *)poid_par_priv->information_buf = + adapter->recvpriv.rx_pkts + adapter->recvpriv.rx_drop; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + return RNDIS_STATUS_SUCCESS; } @@ -147,13 +147,13 @@ uint oid_rt_get_rx_icv_err_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; - if (poid_par_priv->information_buf_len >= sizeof(u32)) { - *(uint *)poid_par_priv->information_buf = -adapter->recvpriv.rx_icv_err; - *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; - } else { + + if (poid_par_priv->information_buf_len < sizeof(u32)) return RNDIS_STATUS_INVALID_LENGTH; - } + + *(uint *)poid_par_priv->information_buf = adapter->recvpriv.rx_icv_err; + *poid_par_priv->bytes_rw = poid_par_priv->information_buf_len; + return RNDIS_STATUS_SUCCESS; } @@ -172,18 +172,20 @@ uint oid_rt_get_preamble_mode_hdl(struct oid_par_priv *poid_par_priv) if (poid_par_priv->type_of_oid != QUERY_OID) return RNDIS_STATUS_NOT_ACCEPTED; - if (poid_par_priv->information_buf_len >= sizeof(u32)) { -