kernel/drivers/disk: enable Werror

* For NVMe library, disable warnings.
* Otherwise, change code to avoid generating warnings.
* No functional change.
* Fixes #9460.

Change-Id: Ia790de391e6b230c909dff7023f00a19bdd574be
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5284
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Jim906 2022-04-30 13:58:22 -04:00 committed by Adrien Destugues
parent 9570ee3534
commit 07d5dba065
5 changed files with 10 additions and 8 deletions

View File

@ -673,7 +673,7 @@ rule ArchitectureSetupWarnings architecture
EnableWerror src add-ons kernel drivers bluetooth ;
EnableWerror src add-ons kernel drivers bus ;
EnableWerror src add-ons kernel drivers common ;
# EnableWerror src add-ons kernel drivers disk ;
EnableWerror src add-ons kernel drivers disk ;
EnableWerror src add-ons kernel drivers dvb ;
# EnableWerror src add-ons kernel drivers graphics ;
EnableWerror src add-ons kernel drivers graphics intel_extreme ;

View File

@ -331,7 +331,7 @@ query_media(floppy_t *flp, bool forceupdate)
{
status_t err = B_OK;
uint8 command[4];
uint8 result[7];
uint8 result[7] = {0};
const floppy_geometry *geom = NULL;
TRACE("query_media(%d, %s)\n", flp->drive_num, forceupdate?"true":"false");

View File

@ -1,5 +1,7 @@
SubDir HAIKU_TOP src add-ons kernel drivers disk nvme ;
SubDirCcFlags -Wno-error ;
UsePrivateKernelHeaders ;
SubDirHdrs $(HAIKU_TOP) src system kernel device_manager ;
SubDirSysHdrs $(HAIKU_TOP) headers compatibility bsd ;

View File

@ -221,7 +221,7 @@ nvme_disk_init_device(void* _info, void** _cookie)
}
// store capacity information
TRACE_ALWAYS("\tblock size: %" B_PRIuSIZE ", stripe size: %" B_PRIu32 "\n",
TRACE_ALWAYS("\tblock size: %" B_PRIuSIZE ", stripe size: %u\n",
nsstat.sector_size, info->ns->stripe_size);
nvme_disk_set_capacity(info, nsstat.sectors, nsstat.sector_size);
@ -275,9 +275,9 @@ nvme_disk_init_device(void* _info, void** _cookie)
}
// allocate qpairs
int32 try_qpairs = cstat.io_qpairs;
uint32 try_qpairs = cstat.io_qpairs;
try_qpairs = min_c(try_qpairs, NVME_MAX_QPAIRS);
if (try_qpairs >= smp_get_num_cpus()) {
if (try_qpairs >= (uint32)smp_get_num_cpus()) {
try_qpairs = smp_get_num_cpus();
} else {
// Find the highest number of qpairs that evenly divides the number of CPUs.
@ -759,7 +759,7 @@ nvme_disk_io(void* cookie, io_request* request)
nvme_request.lba_count = 0;
for (int i = 0; i < nvme_request.iovec_count; i++) {
int32 new_lba_count = nvme_request.lba_count
uint32 new_lba_count = nvme_request.lba_count
+ (nvme_request.iovecs[i].size / block_size);
if (nvme_request.lba_count > 0 && new_lba_count > max_io_blocks) {
// We already have a nonzero length, and adding this vec would

View File

@ -289,7 +289,7 @@ int32 nbd_postoffice(void *arg)
if (err < 0)
goto err;
reason = "recv:size";
if (err < sizeof(reply))
if (err < (status_t)sizeof(reply))
err = EINVAL;
if (err < 0)
goto err;
@ -386,7 +386,7 @@ status_t nbd_connect(struct nbd_device *dev)
err = krecv(dev->sock, &initpkt, sizeof(initpkt), 0);
if (err == -1 && errno < 0)
err = errno;
if (err < sizeof(initpkt))
if (err < (status_t)sizeof(initpkt))
goto err2;
err = EINVAL;//EPROTO;
if (memcmp(initpkt.passwd, NBD_INIT_PASSWD, sizeof(initpkt.passwd)))