Skip to content

Commit 4b9d142

Browse files
authored
Merge pull request #27 from codebrainz/cleanup-warnings
Cleanup compiler warnings
2 parents e29eeb8 + 38470d2 commit 4b9d142

5 files changed

Lines changed: 10 additions & 15 deletions

File tree

kernel/audio/virtio_audio_pci.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ void VirtioAudioDriver::config_channel_maps(){
291291
void VirtioAudioDriver::handle_interrupt(){
292292
select_queue(&audio_dev, EVENT_QUEUE);
293293
struct virtq_used* used = (struct virtq_used*)(uintptr_t)audio_dev.common_cfg->queue_device;
294+
// TODO: desc isn't used in this function, was it supposed to be?
294295
struct virtq_desc* desc = (struct virtq_desc*)(uintptr_t)audio_dev.common_cfg->queue_desc;
295296
struct virtq_avail* avail = (struct virtq_avail*)(uintptr_t)audio_dev.common_cfg->queue_driver;
296297

kernel/input/dwc2.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ bool DWC2Driver::request_sized_descriptor(uint8_t address, uint8_t endpoint, uin
125125
usb_setup_packet packet = {
126126
.bmRequestType = rType,
127127
.bRequest = request,
128-
.wValue = (type << 8) | descriptor_index,
128+
.wValue = (uint16_t)((type << 8) | descriptor_index),
129129
.wIndex = wIndex,
130130
.wLength = descriptor_size
131131
};

kernel/input/input_dispatch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ bool sys_shortcut_triggered(uint16_t pid, uint16_t sid){
126126
}
127127

128128
bool input_init(){
129-
for (int i = 0; i < 16; i++) shortcuts[i] = (shortcut){0};
129+
for (int i = 0; i < 16; i++) shortcuts[i] = {};
130130
if (BOARD_TYPE == 2 && RPI_BOARD != 5){
131131
input_driver = new DWC2Driver();//TODO: QEMU & 3 Only
132132
return input_driver->init();

kernel/input/xhci.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,15 +411,13 @@ bool XHCIDriver::request_sized_descriptor(uint8_t address, uint8_t endpoint, uin
411411
usb_setup_packet packet = {
412412
.bmRequestType = rType,
413413
.bRequest = request,
414-
.wValue = (type << 8) | descriptor_index,
414+
.wValue = (uint16_t)((type << 8) | descriptor_index),
415415
.wIndex = wIndex,
416416
.wLength = descriptor_size
417417
};
418418

419419
// kprintf("RT: %x R: %x V: %x I: %x L: %x",packet.bmRequestType,packet.bRequest,packet.wValue,packet.wIndex,packet.wLength);
420420

421-
bool is_in = (rType & 0x80) != 0;
422-
423421
xhci_ring *transfer_ring = &endpoint_map[address << 8 | endpoint];
424422

425423
trb* setup_trb = &transfer_ring->ring[transfer_ring->index++];
@@ -482,7 +480,7 @@ uint32_t XHCIDriver::calculate_interval(uint32_t speed, uint32_t received_interv
482480

483481
uint32_t i;
484482
for (i = 3; i < 11; i++)
485-
if (125 * (1 << i) >= 1000 * received_interval) break;
483+
if (125u * (1 << i) >= 1000 * received_interval) break;
486484

487485
return i;
488486
}

kernel/networking/port_manager.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66

77
static port_entry_t g_port_table[PROTO_COUNT][MAX_PORTS];//tab proto/port
88

9-
static inline bool port_valid(uint32_t p) {
10-
return p > 0 && p < MAX_PORTS;
11-
}
12-
139
static inline bool proto_valid(protocol_t proto) {
1410
return (uint32_t)proto < PROTO_COUNT;
1511
}
@@ -57,7 +53,7 @@ bool port_bind_manual(protocol_t proto,
5753
uint16_t pid,
5854
port_recv_handler_t handler)
5955
{
60-
if (!proto_valid(proto) || !port_valid(port)) return false;
56+
if (!proto_valid(proto)) return false;
6157
port_entry_t *e = &g_port_table[proto][port];
6258
if (e->used) return false;
6359
e->used = true;
@@ -70,7 +66,7 @@ bool port_unbind(protocol_t proto,
7066
uint16_t port,
7167
uint16_t pid)
7268
{
73-
if (!proto_valid(proto) || !port_valid(port)) return false;
69+
if (!proto_valid(proto)) return false;
7470
port_entry_t *e = &g_port_table[proto][port];
7571
if (!e->used || e->pid != pid) return false;
7672
e->used = false;
@@ -93,17 +89,17 @@ void port_unbind_all(uint16_t pid) {
9389
}
9490

9591
bool port_is_bound(protocol_t proto, uint16_t port) {
96-
if (!proto_valid(proto) || !port_valid(port)) return false;
92+
if (!proto_valid(proto)) return false;
9793
return g_port_table[proto][port].used;
9894
}
9995

10096
uint16_t port_owner_of(protocol_t proto, uint16_t port) {
101-
if (!proto_valid(proto) || !port_valid(port)) return PORT_FREE_OWNER;
97+
if (!proto_valid(proto)) return PORT_FREE_OWNER;
10298
return g_port_table[proto][port].pid;
10399
}
104100

105101
port_recv_handler_t port_get_handler(protocol_t proto, uint16_t port) {
106-
if (!proto_valid(proto) || !port_valid(port)) return NULL;
102+
if (!proto_valid(proto)) return NULL;
107103
return g_port_table[proto][port].used
108104
? g_port_table[proto][port].handler
109105
: NULL;

0 commit comments

Comments
 (0)