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
1db75d47
Commit
1db75d47
authored
Feb 13, 2003
by
Jochen Friedrich
Committed by
Jeff Garzik
Feb 13, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[tokenring madgemc] fix mem leaks, add proper refcounting
parent
79a79c6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
drivers/net/tokenring/madgemc.c
drivers/net/tokenring/madgemc.c
+22
-5
No files found.
drivers/net/tokenring/madgemc.c
View file @
1db75d47
...
@@ -163,7 +163,7 @@ int __init madgemc_probe(void)
...
@@ -163,7 +163,7 @@ int __init madgemc_probe(void)
if
(
!
MCA_bus
)
if
(
!
MCA_bus
)
return
-
1
;
return
-
1
;
while
(
slot
!=
MCA_NOTFOUND
)
{
while
(
slot
!=
MCA_NOTFOUND
)
{
/*
/*
* Currently we only support the MC16/32 (MCA ID 002d)
* Currently we only support the MC16/32 (MCA ID 002d)
...
@@ -180,8 +180,11 @@ int __init madgemc_probe(void)
...
@@ -180,8 +180,11 @@ int __init madgemc_probe(void)
if
((
dev
=
init_trdev
(
NULL
,
0
))
==
NULL
)
{
if
((
dev
=
init_trdev
(
NULL
,
0
))
==
NULL
)
{
printk
(
"madgemc: unable to allocate dev space
\n
"
);
printk
(
"madgemc: unable to allocate dev space
\n
"
);
if
(
madgemc_card_list
)
return
0
;
return
-
1
;
return
-
1
;
}
}
SET_MODULE_OWNER
(
dev
);
dev
->
dma
=
0
;
dev
->
dma
=
0
;
/*
/*
...
@@ -193,6 +196,9 @@ int __init madgemc_probe(void)
...
@@ -193,6 +196,9 @@ int __init madgemc_probe(void)
card
=
kmalloc
(
sizeof
(
struct
madgemc_card
),
GFP_KERNEL
);
card
=
kmalloc
(
sizeof
(
struct
madgemc_card
),
GFP_KERNEL
);
if
(
card
==
NULL
)
{
if
(
card
==
NULL
)
{
printk
(
"madgemc: unable to allocate card struct
\n
"
);
printk
(
"madgemc: unable to allocate card struct
\n
"
);
kfree
(
dev
);
/* release_trdev? */
if
(
madgemc_card_list
)
return
0
;
return
-
1
;
return
-
1
;
}
}
card
->
dev
=
dev
;
card
->
dev
=
dev
;
...
@@ -223,14 +229,14 @@ int __init madgemc_probe(void)
...
@@ -223,14 +229,14 @@ int __init madgemc_probe(void)
if
(
dev
->
irq
==
0
)
{
if
(
dev
->
irq
==
0
)
{
printk
(
"%s: invalid IRQ
\n
"
,
dev
->
name
);
printk
(
"%s: invalid IRQ
\n
"
,
dev
->
name
);
goto
getout
;
goto
getout
1
;
}
}
if
(
!
request_region
(
dev
->
base_addr
,
MADGEMC_IO_EXTENT
,
if
(
!
request_region
(
dev
->
base_addr
,
MADGEMC_IO_EXTENT
,
"madgemc"
))
{
"madgemc"
))
{
printk
(
KERN_INFO
"madgemc: unable to setup Smart MC in slot %d because of I/O base conflict at 0x%04lx
\n
"
,
slot
,
dev
->
base_addr
);
printk
(
KERN_INFO
"madgemc: unable to setup Smart MC in slot %d because of I/O base conflict at 0x%04lx
\n
"
,
slot
,
dev
->
base_addr
);
dev
->
base_addr
+=
MADGEMC_SIF_OFFSET
;
dev
->
base_addr
+=
MADGEMC_SIF_OFFSET
;
goto
getout
;
goto
getout
1
;
}
}
dev
->
base_addr
+=
MADGEMC_SIF_OFFSET
;
dev
->
base_addr
+=
MADGEMC_SIF_OFFSET
;
...
@@ -348,6 +354,14 @@ int __init madgemc_probe(void)
...
@@ -348,6 +354,14 @@ int __init madgemc_probe(void)
if
(
tmsdev_init
(
dev
,
ISA_MAX_ADDRESS
,
NULL
))
{
if
(
tmsdev_init
(
dev
,
ISA_MAX_ADDRESS
,
NULL
))
{
printk
(
"%s: unable to get memory for dev->priv.
\n
"
,
printk
(
"%s: unable to get memory for dev->priv.
\n
"
,
dev
->
name
);
dev
->
name
);
release_region
(
dev
->
base_addr
-
MADGEMC_SIF_OFFSET
,
MADGEMC_IO_EXTENT
);
kfree
(
card
);
tmsdev_term
(
dev
);
kfree
(
dev
);
if
(
madgemc_card_list
)
return
0
;
return
-
1
;
return
-
1
;
}
}
tp
=
(
struct
net_local
*
)
dev
->
priv
;
tp
=
(
struct
net_local
*
)
dev
->
priv
;
...
@@ -376,10 +390,14 @@ int __init madgemc_probe(void)
...
@@ -376,10 +390,14 @@ int __init madgemc_probe(void)
madgemc_card_list
=
card
;
madgemc_card_list
=
card
;
}
else
{
}
else
{
printk
(
"madgemc: register_trdev() returned non-zero.
\n
"
);
printk
(
"madgemc: register_trdev() returned non-zero.
\n
"
);
release_region
(
dev
->
base_addr
-
MADGEMC_SIF_OFFSET
,
MADGEMC_IO_EXTENT
);
kfree
(
card
);
kfree
(
card
);
tmsdev_term
(
dev
);
tmsdev_term
(
dev
);
kfree
(
dev
);
kfree
(
dev
);
if
(
madgemc_card_list
)
return
0
;
return
-
1
;
return
-
1
;
}
}
...
@@ -389,6 +407,7 @@ int __init madgemc_probe(void)
...
@@ -389,6 +407,7 @@ int __init madgemc_probe(void)
getout:
getout:
release_region
(
dev
->
base_addr
-
MADGEMC_SIF_OFFSET
,
release_region
(
dev
->
base_addr
-
MADGEMC_SIF_OFFSET
,
MADGEMC_IO_EXTENT
);
MADGEMC_IO_EXTENT
);
getout1:
kfree
(
card
);
kfree
(
card
);
kfree
(
dev
);
/* release_trdev? */
kfree
(
dev
);
/* release_trdev? */
slot
++
;
slot
++
;
...
@@ -696,7 +715,6 @@ static int madgemc_open(struct net_device *dev)
...
@@ -696,7 +715,6 @@ static int madgemc_open(struct net_device *dev)
*/
*/
madgemc_chipset_init
(
dev
);
madgemc_chipset_init
(
dev
);
tms380tr_open
(
dev
);
tms380tr_open
(
dev
);
MOD_INC_USE_COUNT
;
return
0
;
return
0
;
}
}
...
@@ -704,7 +722,6 @@ static int madgemc_close(struct net_device *dev)
...
@@ -704,7 +722,6 @@ static int madgemc_close(struct net_device *dev)
{
{
tms380tr_close
(
dev
);
tms380tr_close
(
dev
);
madgemc_chipset_close
(
dev
);
madgemc_chipset_close
(
dev
);
MOD_DEC_USE_COUNT
;
return
0
;
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