diff mbox series

[-next] net: phy: micrel: use min() macro instead of doing it manually

Message ID 20211224091208.32274-1-yang.lee@linux.alibaba.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series [-next] net: phy: micrel: use min() macro instead of doing it manually | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Yang Li Dec. 24, 2021, 9:12 a.m. UTC
Fix following coccicheck warning:
./drivers/net/phy/micrel.c:1482:12-13: WARNING opportunity for min()

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 drivers/net/phy/micrel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heiner Kallweit Dec. 24, 2021, 9:30 a.m. UTC | #1
On 24.12.2021 10:12, Yang Li wrote:
> Fix following coccicheck warning:
> ./drivers/net/phy/micrel.c:1482:12-13: WARNING opportunity for min()
> 
Please always check whether a coccicheck warning makes sense,
and don't create "fixes" mechanically w/o thinking.
Here using min() doesn't make sense because it's not about a
numerical operation. ret < 0 is equivalent to is_err(ret).


> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  drivers/net/phy/micrel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index c6a97fcca0e6..dda426596445 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -1479,7 +1479,7 @@ static int ksz886x_cable_test_wait_for_completion(struct phy_device *phydev)
>  				    !(val & KSZ8081_LMD_ENABLE_TEST),
>  				    30000, 100000, true);
>  
> -	return ret < 0 ? ret : 0;
> +	return min(ret, 0);
>  }
>  
>  static int ksz886x_cable_test_one_pair(struct phy_device *phydev, int pair)
diff mbox series

Patch

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index c6a97fcca0e6..dda426596445 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -1479,7 +1479,7 @@  static int ksz886x_cable_test_wait_for_completion(struct phy_device *phydev)
 				    !(val & KSZ8081_LMD_ENABLE_TEST),
 				    30000, 100000, true);
 
-	return ret < 0 ? ret : 0;
+	return min(ret, 0);
 }
 
 static int ksz886x_cable_test_one_pair(struct phy_device *phydev, int pair)