Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix signed/unsigned comparison for subsystem ID #77

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions tn40.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,18 @@ static enum PHY_TYPE bdx_phy_init(struct bdx_priv *priv)
bdx_get_phy_by_id(pdev->vendor, pdev->device,
pdev->subsystem_device);

if (phy_type == PHY_TYPE_NA)
if (phy_type == PHY_TYPE_NA){
dev_info(&priv->pdev->dev, "No PHY for subsystem_device [%4x:%4x:%4x]\n", pdev->vendor, pdev->device, pdev->subsystem_device);
return PHY_TYPE_NA; /* NIC definition has no PHY. */

}
bdx_mdio_set_speed(priv->pBdxRegs, MDIO_SPEED_1MHZ);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent with a hard tab to follow the codestyle in the rest of the file. Also one more occurance below. (minor, doesn't hinder merge)


phy_id = bdx_mdio_scan_phy_id(priv); /* set phy_mdio_port */

if (!priv->phy_mdio_port)
if (!priv->phy_mdio_port){
dev_info(&priv->pdev->dev, "No PHY on MDIO bus\n");
return PHY_TYPE_NA; /* No PHY detected on MDIO bus. */

}
/* register the PHY-specific callbacks */
priv->phy_type = bdx_phy_register(priv, phy_id, &desc);

Expand Down Expand Up @@ -2857,7 +2859,7 @@ static int bdx_get_phy_by_id(int vendor, int device, int subsystem)
)
return bdx_dev_tbl[i].phy_type;
}
return 0;
return PHY_TYPE_NA;
}
Comment on lines 2860 to 2863
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change return type of the function to enum PHY_TYPE. (minor, doesn't hinder merge)

Copy link
Author

@jwstolk jwstolk Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the feedback. I did a commit to the same branch and it looks like that included it in the same pull request automatically. (still finding my way around git and github) Please let me know if there are other issues or comments.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it looks good now. Another minor code style issue is a space before the first { in the if body.

I don't have merge rights, so we'll have to wait until someone that has, comes around.


static void __init bdx_init_net_device(struct net_device *ndev,
Expand Down
6 changes: 3 additions & 3 deletions tn40.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ enum PHY_LEDS_OP {

/* Supported devices */
struct bdx_device_descr {
short vid;
short pid;
short subdev;
__u16 vid;
__u16 pid;
__u16 subdev;
enum PHY_TYPE phy_type;
char *name;
};
Expand Down