diff mbox series

ethernet: sis900: use sizeof(*pointer) instead of sizeof(type)

Message ID AS8PR02MB7237F187447FF71AE515333B8BC42@AS8PR02MB7237.eurprd02.prod.outlook.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series ethernet: sis900: use sizeof(*pointer) instead of sizeof(type) | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 864 this patch: 864
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 868 this patch: 868
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 868 this patch: 868
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 21 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 19 this patch: 19
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-06-09--21-00 (tests: 644)

Commit Message

Erick Archer June 8, 2024, 10:20 a.m. UTC
It is preferred to use sizeof(*pointer) instead of sizeof(type)
due to the type of the variable can change and one needs not
change the former (unlike the latter).

At the same time remove some unnecessary initializations and
refactor a bit to make the code clearer.

This patch has no effect on runtime behavior.

Signed-off-by: Erick Archer <erick.archer@outlook.com>
---
 drivers/net/ethernet/sis/sis900.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jakub Kicinski June 13, 2024, 12:55 a.m. UTC | #1
On Sat,  8 Jun 2024 12:20:33 +0200 Erick Archer wrote:
> It is preferred to use sizeof(*pointer) instead of sizeof(type)
> due to the type of the variable can change and one needs not
> change the former (unlike the latter).
> 
> At the same time remove some unnecessary initializations and
> refactor a bit to make the code clearer.
> 
> This patch has no effect on runtime behavior.

This is an ancient driver, unfortunately we prefer not to apply minor
code cleanups of this nature unless they are a part of other development
work. We'd be constantly tweaking the 200+ drivers we have, most of
which get zero use.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/sis/sis900.c b/drivers/net/ethernet/sis/sis900.c
index 85b850372efe..5b82c4763de9 100644
--- a/drivers/net/ethernet/sis/sis900.c
+++ b/drivers/net/ethernet/sis/sis900.c
@@ -614,11 +614,10 @@  static int sis900_mii_probe(struct net_device *net_dev)
 
 	/* search for total of 32 possible mii phy addresses */
 	for (phy_addr = 0; phy_addr < 32; phy_addr++) {
-		struct mii_phy * mii_phy = NULL;
+		struct mii_phy *mii_phy;
 		u16 mii_status;
 		int i;
 
-		mii_phy = NULL;
 		for(i = 0; i < 2; i++)
 			mii_status = mdio_read(net_dev, phy_addr, MII_STATUS);
 
@@ -630,7 +629,8 @@  static int sis900_mii_probe(struct net_device *net_dev)
 			continue;
 		}
 
-		if ((mii_phy = kmalloc(sizeof(struct mii_phy), GFP_KERNEL)) == NULL) {
+		mii_phy = kmalloc(sizeof(*mii_phy), GFP_KERNEL);
+		if (!mii_phy) {
 			mii_phy = sis_priv->first_mii;
 			while (mii_phy) {
 				struct mii_phy *phy;