This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "A pseudo Operating System for the Dreamcast.".
The branch, master has been updated
via 3e3b43cf757098c84cf4e67681a02ef3901c6cc8 (commit)
via 36930c633381a6289247c33427ad67eea1ed3ea3 (commit)
via 580cc829436cbb9d025dac308add2ffe9c14a80b (commit)
from 0b93371d65163e8fb9e5a1902d5ec45be3e0df0f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3e3b43cf757098c84cf4e67681a02ef3901c6cc8
Merge: 580cc82 36930c6
Author: Lawrence Sebald <ljs...@us...>
Date: Fri Oct 6 18:03:07 2023 -0400
Merge pull request #318 from Tchan0/LAN_adapter_dont_register_if_not_present
la_init(): early exit if LAN adapter not detected
commit 36930c633381a6289247c33427ad67eea1ed3ea3
Author: Tchan0 <617...@us...>
Date: Sun Oct 1 07:51:27 2023 +0200
la_init: early exit if not detected
Align LAN's la_init() with the BBA code:
if not present, do not register, and do not read flashrom
commit 580cc829436cbb9d025dac308add2ffe9c14a80b
Author: Tchan0 <617...@us...>
Date: Sat Sep 30 18:58:00 2023 +0200
maple_dev_status: check for nullptr input (#317)
maple_dev_status() does not check for NULL passed as input parameter, crashing eg nehe06 when no controller was detected
-----------------------------------------------------------------------
Summary of changes:
kernel/arch/dreamcast/hardware/maple/maple_enum.c | 2 +-
kernel/arch/dreamcast/hardware/network/lan_adapter.c | 11 +++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/kernel/arch/dreamcast/hardware/maple/maple_enum.c b/kernel/arch/dreamcast/hardware/maple/maple_enum.c
index 618e08d..a0f9c5b 100644
--- a/kernel/arch/dreamcast/hardware/maple/maple_enum.c
+++ b/kernel/arch/dreamcast/hardware/maple/maple_enum.c
@@ -103,7 +103,7 @@ maple_device_t * maple_enum_type_ex(int n, uint32 func, uint32 cap) {
valid before returning. Cast to the appropriate type you're expecting. */
void * maple_dev_status(maple_device_t *dev) {
/* Is the device valid? */
- if(!dev->valid)
+ if(!dev || !dev->valid)
return NULL;
/* Waits until the first DMA happens: crude but effective (replace me later) */
diff --git a/kernel/arch/dreamcast/hardware/network/lan_adapter.c b/kernel/arch/dreamcast/hardware/network/lan_adapter.c
index 53bdca2..fb8703a 100644
--- a/kernel/arch/dreamcast/hardware/network/lan_adapter.c
+++ b/kernel/arch/dreamcast/hardware/network/lan_adapter.c
@@ -330,7 +330,6 @@ static int la_detect(void) {
type = DLCR7_IDENT(la_read(DLCR7));
if(type != DLCR7_ID_MB86967) {
- dbglog(DBG_KDEBUG, "lan_adapter: no device detected (wrong type = %d)\n", type);
return -1;
}
@@ -746,6 +745,14 @@ int la_init(void) {
la_if.index = 0;
la_if.dev_id = 0;
la_if.flags = NETIF_NO_FLAGS;
+ la_if.if_detect = la_if_detect;
+
+ /* Short circuit if no lan is detected */
+ if(la_if.if_detect(&la_if) < 0) {
+ dbglog(DBG_KDEBUG, "lan: no device detected\n");
+ return -1;
+ }
+
memset(la_if.ip_addr, 0, sizeof(la_if.ip_addr));
memset(la_if.netmask, 0, sizeof(la_if.netmask));
memset(la_if.gateway, 0, sizeof(la_if.gateway));
@@ -758,7 +765,7 @@ int la_init(void) {
memset(&la_if.ip6_gateway, 0, sizeof(la_if.ip6_gateway));
la_if.mtu6 = 0;
la_if.hop_limit = 0;
- la_if.if_detect = la_if_detect;
+
la_if.if_init = la_if_init;
la_if.if_shutdown = la_if_shutdown;
la_if.if_start = la_if_start;
hooks/post-receive
--
A pseudo Operating System for the Dreamcast.
|