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
ed947ded
Commit
ed947ded
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 gt96100eth] use alloc_etherdev, fix leaks
parent
530036d3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
20 deletions
+29
-20
drivers/net/gt96100eth.c
drivers/net/gt96100eth.c
+29
-20
No files found.
drivers/net/gt96100eth.c
View file @
ed947ded
...
...
@@ -729,10 +729,12 @@ gt96100_probe1(int port_num)
return
-
EBUSY
;
}
dev
=
init_etherdev
(
0
,
sizeof
(
struct
gt96100_private
));
dev
=
alloc_etherdev
(
sizeof
(
struct
gt96100_private
));
if
(
!
dev
)
goto
out
;
gtif
->
dev
=
dev
;
/* private struct aligned and zeroed by
init
_etherdev */
/* private struct aligned and zeroed by
alloc
_etherdev */
/* Fill in the 'dev' fields. */
dev
->
base_addr
=
gtif
->
iobase
;
dev
->
irq
=
gtif
->
irq
;
...
...
@@ -740,7 +742,7 @@ gt96100_probe1(int port_num)
if
((
retval
=
parse_mac_addr
(
dev
,
gtif
->
mac_str
)))
{
err
(
"%s: MAC address parse failed
\n
"
,
__FUNCTION__
);
retval
=
-
EINVAL
;
goto
free_region
;
goto
out1
;
}
gp
=
dev
->
priv
;
...
...
@@ -768,7 +770,7 @@ gt96100_probe1(int port_num)
&
gp
->
rx_ring_dma
);
if
(
gp
->
rx_ring
==
NULL
)
{
retval
=
-
ENOMEM
;
goto
free_region
;
goto
out1
;
}
gp
->
tx_ring
=
(
gt96100_td_t
*
)(
gp
->
rx_ring
+
RX_RING_SIZE
);
...
...
@@ -781,11 +783,8 @@ gt96100_probe1(int port_num)
gp
->
rx_buff
=
dmaalloc
(
PKT_BUF_SZ
*
RX_RING_SIZE
,
&
gp
->
rx_buff_dma
);
if
(
gp
->
rx_buff
==
NULL
)
{
dmafree
(
sizeof
(
gt96100_rd_t
)
*
RX_RING_SIZE
+
sizeof
(
gt96100_td_t
)
*
TX_RING_SIZE
,
gp
->
rx_ring
);
retval
=
-
ENOMEM
;
goto
free_region
;
goto
out2
;
}
}
...
...
@@ -797,12 +796,8 @@ gt96100_probe1(int port_num)
gp
->
hash_table
=
(
char
*
)
dmaalloc
(
RX_HASH_TABLE_SIZE
,
&
gp
->
hash_table_dma
);
if
(
gp
->
hash_table
==
NULL
)
{
dmafree
(
sizeof
(
gt96100_rd_t
)
*
RX_RING_SIZE
+
sizeof
(
gt96100_td_t
)
*
TX_RING_SIZE
,
gp
->
rx_ring
);
dmafree
(
PKT_BUF_SZ
*
RX_RING_SIZE
,
gp
->
rx_buff
);
retval
=
-
ENOMEM
;
goto
free_region
;
goto
out3
;
}
}
...
...
@@ -819,14 +814,23 @@ gt96100_probe1(int port_num)
dev
->
tx_timeout
=
gt96100_tx_timeout
;
dev
->
watchdog_timeo
=
GT96100ETH_TX_TIMEOUT
;
/* Fill in the fields of the device structure with ethernet values. */
ether_setup
(
dev
);
retval
=
register_netdev
(
dev
);
if
(
retval
)
goto
out4
;
return
0
;
free_region:
release_region
(
gtif
->
iobase
,
GT96100_ETH_IO_SIZE
);
unregister_netdev
(
dev
);
out4:
dmafree
(
RX_HASH_TABLE_SIZE
,
gp
->
hash_table_dma
);
out3:
dmafree
(
PKT_BUF_SZ
*
RX_RING_SIZE
,
gp
->
rx_buff
);
out2:
dmafree
(
sizeof
(
gt96100_rd_t
)
*
RX_RING_SIZE
+
sizeof
(
gt96100_td_t
)
*
TX_RING_SIZE
,
gp
->
rx_ring
);
out1:
free_netdev
(
dev
);
out:
release_region
(
gtif
->
iobase
,
GT96100_ETH_IO_SIZE
);
err
(
"%s failed. Returns %d
\n
"
,
__FUNCTION__
,
retval
);
return
retval
;
}
...
...
@@ -1573,9 +1577,14 @@ static void gt96100_cleanup_module(void)
if
(
gtif
->
dev
!=
NULL
)
{
struct
gt96100_private
*
gp
=
(
struct
gt96100_private
*
)
gtif
->
dev
->
priv
;
release_region
(
gtif
->
iobase
,
gp
->
io_size
);
unregister_netdev
(
gtif
->
dev
);
free_netdev
(
gtif
->
dev
);
dmafree
(
RX_HASH_TABLE_SIZE
,
gp
->
hash_table_dma
);
dmafree
(
PKT_BUF_SZ
*
RX_RING_SIZE
,
gp
->
rx_buff
);
dmafree
(
sizeof
(
gt96100_rd_t
)
*
RX_RING_SIZE
+
sizeof
(
gt96100_td_t
)
*
TX_RING_SIZE
,
gp
->
rx_ring
);
free_netdev
(
gtif
->
dev
);
release_region
(
gtif
->
iobase
,
gp
->
io_size
);
}
}
}
...
...
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