Skip to content

Commit

Permalink
pcie_check: fix some pcie_check compilation warnings
Browse files Browse the repository at this point in the history
1. Fixed warning: suggest parentheses around ‘-’ in operand of ‘&’
   [-Wparentheses]:
   if (width > 0 && width < 17 && (width & width - 1) == 0)
2. Removed unused result, nextpoint.

Signed-off-by: Pengfei Xu <[email protected]>
  • Loading branch information
xupengfe authored and ysun committed Jul 4, 2024
1 parent 4c982cd commit fb3ce8a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions BM/tools/pcie/pcie_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ void speed_show(u8 speed)
void linkwidth(u8 width)
{
printf("\tLink Capabilities Register(0x0c bit9:4) width:%02x - ", width);
if (width > 0 && width < 17 && (width & width - 1) == 0)
if (width > 0 && width < 17 && (width & (width - 1)) == 0)
printf("x%d\n", width);
else
printf("reserved\n");
Expand Down Expand Up @@ -511,8 +511,7 @@ int scan_pci(void)
u32 bus, dev, fun;
// Must 32bit for data check!
u32 *ptrdata = malloc(sizeof(unsigned long) * 4096);
u8 nextpoint;
int fd, result;
int fd;

fd = open("/dev/mem", O_RDWR);

Expand Down

0 comments on commit fb3ce8a

Please sign in to comment.