Skip to content
Closed
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
14 changes: 7 additions & 7 deletions nvme-print-stdout.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,9 +776,9 @@ static void stdout_eom_printable_eye(struct nvme_eom_lane_desc *lane)
char *eye = (char *)lane->eye_desc;
int i, j;

for (i = 0; i < lane->nrows; i++) {
for (j = 0; j < lane->ncols; j++)
printf("%c", eye[i * lane->ncols + j]);
for (i = 0; i < le16_to_cpu(lane->nrows); i++) {
for (j = 0; j < le16_to_cpu(lane->ncols); j++)
printf("%c", eye[i * le16_to_cpu(lane->ncols) + j]);
printf("\n");
}
}
Expand Down Expand Up @@ -809,16 +809,16 @@ static void stdout_phy_rx_eom_descs(struct nvme_phy_rx_eom_log *log)
stdout_eom_printable_eye(desc);

/* Eye Data field is vendor specific */
if (desc->edlen == 0)
if (le16_to_cpu(desc->edlen) == 0)
continue;

/* Hex dump Vendor Specific Eye Data */
vsdata = malloc(desc->edlen);
vsdataoffset = (desc->nrows * desc->ncols) +
vsdata = malloc(le16_to_cpu(desc->edlen));
vsdataoffset = (le16_to_cpu(desc->nrows) * le16_to_cpu(desc->ncols)) +
Copy link
Collaborator

Choose a reason for hiding this comment

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

please introduce local varables instead redoing the cpu conversion everytime.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Modified as suggested.

sizeof(struct nvme_eom_lane_desc);
vsdata = (unsigned char *)((unsigned char *)desc + vsdataoffset);
printf("Eye Data:\n");
d(vsdata, desc->edlen, 16, 1);
d(vsdata, le16_to_cpu(desc->edlen), 16, 1);
printf("\n");

p += log->dsize;
Expand Down