Skip to content

Commit

Permalink
ethernet: sis900: use sizeof(*pointer) instead of sizeof(type)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: NipaLocal <nipa@local>
  • Loading branch information
Erick Archer authored and NipaLocal committed Jun 12, 2024
1 parent 6e358a7 commit 4c837b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/sis/sis900.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down

0 comments on commit 4c837b0

Please sign in to comment.