Message ID | 1609308450-50695-1-git-send-email-abaci-bugfix@linux.alibaba.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | liquidio: style: Identical condition and return expression 'retval', return value is always 0. | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | success | CCed 6 of 6 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 12 this patch: 12 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
On Wed, 2020-12-30 at 14:07 +0800, YANG LI wrote: > The warning was because of the following line in function > liquidio_set_fec(): > > retval = wait_for_sc_completion_timeout(oct, sc, 0); > if (retval) > return (-EIO); I presume abaci is a robot Perhaps also the robot could look for code immediately above this like: oct->props[lio->ifidx].fec = var; if (resp->fec_setting == SEAPI_CMD_FEC_SET_RS) oct->props[lio->ifidx].fec = 1; else oct->props[lio->ifidx].fec = 0; where a location is immediately overwritten. so the line oct->props[lio->ifidx].fec = var; could be highlighted and perhaps removed and also perhaps the second test and set block could be written oct->props[lio->ifidx].fec = resp->fec_setting == SEAPI_CMD_FEC_SET_RS;
From: YANG LI <abaci-bugfix@linux.alibaba.com> Date: Wed, 30 Dec 2020 14:07:30 +0800 > The warning was because of the following line in function > liquidio_set_fec(): > > retval = wait_for_sc_completion_timeout(oct, sc, 0); > if (retval) > return (-EIO); > > If this statement is not true, retval must be 0 and not updated > later. So, It is better to return 0 directly. > > Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com> > Reported-by: Abaci <abaci@linux.alibaba.com> Maybe you can remove the rest of the 'retval' usage in this function and even the variable itself? Thanks.
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_core.c b/drivers/net/ethernet/cavium/liquidio/lio_core.c index 37d0641..6e2426f 100644 --- a/drivers/net/ethernet/cavium/liquidio/lio_core.c +++ b/drivers/net/ethernet/cavium/liquidio/lio_core.c @@ -1747,7 +1747,7 @@ int liquidio_set_fec(struct lio *lio, int on_off) oct->props[lio->ifidx].fec ? "on" : "off"); } - return retval; + return 0; } int liquidio_get_fec(struct lio *lio)
The warning was because of the following line in function liquidio_set_fec(): retval = wait_for_sc_completion_timeout(oct, sc, 0); if (retval) return (-EIO); If this statement is not true, retval must be 0 and not updated later. So, It is better to return 0 directly. Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com> Reported-by: Abaci <abaci@linux.alibaba.com> --- drivers/net/ethernet/cavium/liquidio/lio_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)