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
nexedi
linux
Commits
12ea7c9d
Commit
12ea7c9d
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 fec] switched to sane allocation. It still leaks on failure exits, though.
parent
61798461
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
drivers/net/fec.c
drivers/net/fec.c
+24
-15
No files found.
drivers/net/fec.c
View file @
12ea7c9d
...
...
@@ -1638,9 +1638,12 @@ fec_set_mac_address(struct net_device *dev)
/* Initialize the FEC Ethernet on 860T (or ColdFire 5272).
*/
/*
* XXX: We need to clean up on failure exits here.
*/
int
__init
fec_enet_init
(
struct
net_device
*
dev
)
{
struct
fec_enet_private
*
fep
;
struct
fec_enet_private
*
fep
=
dev
->
priv
;
unsigned
long
mem_addr
;
volatile
cbd_t
*
bdp
;
cbd_t
*
cbd_base
;
...
...
@@ -1651,13 +1654,6 @@ int __init fec_enet_init(struct net_device *dev)
if
(
found
)
return
(
-
ENXIO
);
/* Allocate some private information.
*/
fep
=
(
struct
fec_enet_private
*
)
kmalloc
(
sizeof
(
*
fep
),
GFP_KERNEL
);
if
(
!
fep
)
return
-
ENOMEM
;
memset
(
fep
,
0
,
sizeof
(
*
fep
));
/* Create an Ethernet device instance.
*/
fecp
=
fec_hwp
;
...
...
@@ -1694,6 +1690,7 @@ int __init fec_enet_init(struct net_device *dev)
}
mem_addr
=
__get_free_page
(
GFP_KERNEL
);
cbd_base
=
(
cbd_t
*
)
mem_addr
;
/* XXX: missing check for allocation failure */
fec_uncache
(
mem_addr
);
...
...
@@ -1715,6 +1712,7 @@ int __init fec_enet_init(struct net_device *dev)
/* Allocate a page.
*/
mem_addr
=
__get_free_page
(
GFP_KERNEL
);
/* XXX: missing check for allocation failure */
fec_uncache
(
mem_addr
);
...
...
@@ -1761,9 +1759,6 @@ int __init fec_enet_init(struct net_device *dev)
fec_request_intrs
(
dev
,
fecp
);
dev
->
base_addr
=
(
unsigned
long
)
fecp
;
dev
->
priv
=
fep
;
ether_setup
(
dev
);
/* The FEC Ethernet specific entries in the device structure. */
dev
->
open
=
fec_enet_open
;
...
...
@@ -1949,14 +1944,28 @@ fec_stop(struct net_device *dev)
fecp
->
fec_mii_speed
=
fep
->
phy_speed
;
}
static
struct
net_device
fec_dev
=
{
.
init
=
fec_enet_init
,
};
static
struct
net_device
*
fec_dev
;
static
int
__init
fec_enet_module_init
(
void
)
{
if
(
register_netdev
(
&
fec_dev
)
!=
0
)
struct
net_device
*
dev
;
int
err
;
dev
=
alloc_etherdev
(
sizeof
(
struct
fec_enet_private
));
if
(
!
dev
)
return
-
ENOMEM
;
err
=
fec_enet_init
(
dev
);
if
(
err
)
{
free_netdev
(
dev
);
return
err
;
}
if
(
register_netdev
(
dev
)
!=
0
)
{
/* XXX: missing cleanup here */
free_netdev
(
dev
);
return
-
EIO
;
}
fec_dev
=
dev
;
return
(
0
);
}
...
...
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