Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
d41a435d
Commit
d41a435d
authored
Jan 10, 2004
by
Alexander Viro
Committed by
Stephen Hemminger
Jan 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr oaknet] use alloc_etherdev, fix leaks
parent
c3019156
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
39 deletions
+22
-39
drivers/net/oaknet.c
drivers/net/oaknet.c
+22
-39
No files found.
drivers/net/oaknet.c
View file @
d41a435d
...
...
@@ -94,8 +94,8 @@ static int __init oaknet_init(void)
{
register
int
i
;
int
reg0
,
regd
;
int
ret
;
struct
net_device
tmp
,
*
dev
=
NULL
;
int
ret
=
-
ENOMEM
;
struct
net_device
*
dev
;
#if 0
unsigned long ioaddr = OAKNET_IO_BASE;
#else
...
...
@@ -105,17 +105,15 @@ static int __init oaknet_init(void)
if
(
!
ioaddr
)
return
-
ENOMEM
;
/*
* This MUST happen here because of the nic_* macros
* which have an implicit dependency on dev->base_addr.
*/
tmp
.
base_addr
=
ioaddr
;
dev
=
&
tmp
;
dev
=
alloc_etherdev
(
0
);
if
(
!
dev
)
goto
out_unmap
;
dev
->
priv
=
NULL
;
ret
=
-
EBUSY
;
if
(
!
request_region
(
OAKNET_IO_BASE
,
OAKNET_IO_SIZE
,
name
))
goto
out_
unmap
;
goto
out_
dev
;
/* Quick register check to see if the device is really there. */
...
...
@@ -144,17 +142,7 @@ static int __init oaknet_init(void)
goto
out_region
;
}
/*
* We're not using the old-style probing API, so we have to allocate
* our own device structure.
*/
dev
=
init_etherdev
(
NULL
,
0
);
ret
=
-
ENOMEM
;
if
(
!
dev
)
goto
out_region
;
SET_MODULE_OWNER
(
dev
);
oaknet_devs
=
dev
;
/*
* This controller is on an embedded board, so the base address
...
...
@@ -169,7 +157,7 @@ static int __init oaknet_init(void)
ret
=
-
ENOMEM
;
if
(
ethdev_init
(
dev
))
{
printk
(
" unable to get memory for dev->priv.
\n
"
);
goto
out_
dev
;
goto
out_
region
;
}
/*
...
...
@@ -215,15 +203,21 @@ static int __init oaknet_init(void)
dev
->
stop
=
oaknet_close
;
NS8390_init
(
dev
,
FALSE
);
ret
=
register_netdev
(
dev
);
if
(
ret
)
goto
out_irq
;
oaknet_devs
=
dev
;
return
0
;
return
(
0
);
out_irq
;
free_irq
(
dev
->
irq
,
dev
);
out_priv:
kfree
(
dev
->
priv
);
out_dev:
unregister_netdev
(
dev
);
kfree
(
dev
);
out_region:
release_region
(
OAKNET_IO_BASE
,
OAKNET_IO_SIZE
);
out_dev:
free_netdev
(
dev
);
out_unmap:
iounmap
(
ioaddr
);
return
ret
;
...
...
@@ -661,17 +655,6 @@ oaknet_dma_error(struct net_device *dev, const char *name)
dev
->
interrupt
);
}
/*
* Oak Ethernet module load interface.
*/
static
int
__init
oaknet_init_module
(
void
)
{
if
(
oaknet_devs
!=
NULL
)
return
(
-
EBUSY
);
return
(
oaknet_init
());
}
/*
* Oak Ethernet module unload interface.
*/
...
...
@@ -683,17 +666,17 @@ static void __exit oaknet_cleanup_module (void)
if
(
oaknet_devs
->
priv
!=
NULL
)
{
int
ioaddr
=
oaknet_devs
->
base_addr
;
void
*
priv
=
oaknet_devs
->
priv
;
unregister_netdev
(
oaknet_dev
);
free_irq
(
oaknet_devs
->
irq
,
oaknet_devs
);
kfree
(
priv
);
release_region
(
ioaddr
,
OAKNET_IO_SIZE
);
iounmap
(
ioaddr
);
unregister_netdev
(
oaknet_dev
);
free_netdev
(
priv
);
}
/* Convert to loop once driver supports multiple devices. */
kfree
(
oaknet_devs
);
free_netdev
(
oaknet_devs
);
}
module_init
(
oaknet_init
_module
);
module_init
(
oaknet_init
);
module_exit
(
oaknet_cleanup_module
);
MODULE_LICENSE
(
"GPL"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment