Browse Source

fixed warnings

master
Mathieu Serandour 11 months ago
parent
commit
8ea0a5b296
  1. 17
      kernel/drivers/nvme/nvme.c
  2. 6
      kernel/drivers/nvme/nvme.h

17
kernel/drivers/nvme/nvme.c

@ -91,7 +91,7 @@ void perform_write_command(
struct data* data,
struct regs* regs,
uint64_t lba,
void* _buf,
const void* _buf,
size_t count
);
@ -101,11 +101,11 @@ static void rename_device(struct pcie_dev* dev) {
string_free(&dev->dev.name);
dev->dev.name = (string_t){malloc(16), 1};
sprintf(dev->dev.name.ptr,
"nvme%un1", id++);
char* buf = malloc(16);
sprintf(buf, "nvme%un1", id++);
dev->dev.name = (string_t){buf, 1};
// only namespace 1 is supported
// for now
@ -891,10 +891,9 @@ void perform_write_command(
struct data* data,
struct regs* regs,
uint64_t lba,
void* _buf,
const void* _buf,
size_t count
) {
panic("too dangerous operation");
// general assert protection
assert(lba < data->namespaces[0].capacity);
assert(lba + count < data->namespaces[0].capacity);
@ -1013,7 +1012,7 @@ void nvme_sync_read(struct driver* this,
void nvme_sync_write(struct driver* this,
uint64_t lba,
void* buf,
const void* buf,
size_t count
) {
assert(this->status == DRIVER_STATE_OK);

6
kernel/drivers/nvme/nvme.h

@ -40,9 +40,9 @@ void nvme_sync_read(struct driver* this,
* @param count the number of blocks to read
*/
void nvme_sync_write(struct driver* this,
uint64_t lba,
void* buf,
size_t count);
uint64_t lba,
const void* buf,
size_t count);
#define NVME_INVALID_IO_QUEUE (~0u)

Loading…
Cancel
Save