Skip to content
Snippets Groups Projects
Commit c7d0fd79 authored by Andre Przywara's avatar Andre Przywara Committed by Tom Rini
Browse files

scsi: fix compiler warning with DEBUG and 48bit LBAs


Commit 2b42c931 ("ahci: support LBA48 data reads for 2+TB drives")
introduced conditional code which triggers a warning when compiled
with DEBUG enabled:

In file included from common/cmd_scsi.c:12:0:
common/cmd_scsi.c: In function 'scsi_read':
include/common.h:109:4: warning: 'smallblks' may be used uninitialized in this function [-Wmaybe-uninitialized]
...

Since this is for debug only, take the easy way and initialize the
variable explicitly on declaration to avoid the warning.
(Fix a nearby whitespace error on the way.)

Tested-by: default avatarBin Meng <bmeng.cn@gmail.com>
Signed-off-by: default avatarAndre Przywara <osp@andrep.de>
parent 2650dbcf
No related branches found
No related tags found
No related merge requests found
...@@ -368,7 +368,7 @@ static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt, ...@@ -368,7 +368,7 @@ static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
{ {
lbaint_t start, blks; lbaint_t start, blks;
uintptr_t buf_addr; uintptr_t buf_addr;
unsigned short smallblks; unsigned short smallblks = 0;
ccb* pccb=(ccb *)&tempccb; ccb* pccb=(ccb *)&tempccb;
device&=0xff; device&=0xff;
/* Setup device /* Setup device
...@@ -391,7 +391,7 @@ static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt, ...@@ -391,7 +391,7 @@ static ulong scsi_read(int device, lbaint_t blknr, lbaint_t blkcnt,
scsi_setup_read16(pccb, start, blocks); scsi_setup_read16(pccb, start, blocks);
start += blocks; start += blocks;
blks -= blocks; blks -= blocks;
} else } else
#endif #endif
if (blks > SCSI_MAX_READ_BLK) { if (blks > SCSI_MAX_READ_BLK) {
pccb->datalen=scsi_dev_desc[device].blksz * SCSI_MAX_READ_BLK; pccb->datalen=scsi_dev_desc[device].blksz * SCSI_MAX_READ_BLK;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment