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
f5d1862d
Commit
f5d1862d
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 saa9730] use alloc_etherdev, annotate bugs found but not fixed
parent
b91a902e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
32 deletions
+31
-32
drivers/net/saa9730.c
drivers/net/saa9730.c
+31
-32
No files found.
drivers/net/saa9730.c
View file @
f5d1862d
...
@@ -996,11 +996,11 @@ static void __devexit saa9730_remove_one(struct pci_dev *pdev)
...
@@ -996,11 +996,11 @@ static void __devexit saa9730_remove_one(struct pci_dev *pdev)
struct
net_device
*
dev
=
pci_get_drvdata
(
pdev
);
struct
net_device
*
dev
=
pci_get_drvdata
(
pdev
);
if
(
dev
)
{
if
(
dev
)
{
unregister_netdev
(
dev
);
if
(
dev
->
priv
)
if
(
dev
->
priv
)
kfree
(
dev
->
priv
);
kfree
(
dev
->
priv
);
unregister_netdev
(
dev
);
free_netdev
(
dev
);
free_netdev
(
dev
);
pci_release_regions
(
pdev
);
pci_release_regions
(
pdev
);
pci_disable_device
(
pdev
);
pci_disable_device
(
pdev
);
...
@@ -1015,17 +1015,10 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
...
@@ -1015,17 +1015,10 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
unsigned
char
ethernet_addr
[
6
];
unsigned
char
ethernet_addr
[
6
];
int
ret
=
0
;
int
ret
=
0
;
dev
=
init_etherdev
(
dev
,
0
);
if
(
!
dev
)
return
-
ENOMEM
;
dev
->
open
=
lan_saa9730_open_fail
;
dev
->
open
=
lan_saa9730_open_fail
;
if
(
get_ethernet_addr
(
ethernet_addr
))
{
if
(
get_ethernet_addr
(
ethernet_addr
))
ret
=
-
ENODEV
;
return
-
ENODEV
;
goto
out
;
}
memcpy
(
dev
->
dev_addr
,
ethernet_addr
,
6
);
memcpy
(
dev
->
dev_addr
,
ethernet_addr
,
6
);
dev
->
base_addr
=
ioaddr
;
dev
->
base_addr
=
ioaddr
;
...
@@ -1040,10 +1033,8 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
...
@@ -1040,10 +1033,8 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
GFP_DMA
|
GFP_KERNEL
)
GFP_DMA
|
GFP_KERNEL
)
+
7
)
&
~
7
);
+
7
)
&
~
7
);
if
(
!
lp
)
{
if
(
!
lp
)
ret
=
-
ENOMEM
;
return
-
ENOMEM
;
goto
out
;
}
dev
->
priv
=
lp
;
dev
->
priv
=
lp
;
memset
(
lp
,
0
,
sizeof
(
*
lp
));
memset
(
lp
,
0
,
sizeof
(
*
lp
));
...
@@ -1057,6 +1048,7 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
...
@@ -1057,6 +1048,7 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
SAA9730_EVM_REGS_ADDR
);
SAA9730_EVM_REGS_ADDR
);
/* Allocate LAN RX/TX frame buffer space. */
/* Allocate LAN RX/TX frame buffer space. */
/* FIXME: a leak */
if
((
ret
=
lan_saa9730_allocate_buffers
(
lp
)))
if
((
ret
=
lan_saa9730_allocate_buffers
(
lp
)))
goto
out
;
goto
out
;
...
@@ -1095,63 +1087,70 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
...
@@ -1095,63 +1087,70 @@ static int lan_saa9730_init(struct net_device *dev, int ioaddr, int irq)
dev
->
watchdog_timeo
=
(
HZ
>>
1
);
dev
->
watchdog_timeo
=
(
HZ
>>
1
);
dev
->
dma
=
0
;
dev
->
dma
=
0
;
ret
=
register_netdev
(
dev
);
if
(
ret
)
goto
out
;
return
0
;
return
0
;
out:
out:
if
(
dev
)
{
if
(
dev
->
priv
)
if
(
dev
->
priv
)
kfree
(
dev
->
priv
);
kfree
(
dev
->
priv
);
free_netdev
(
dev
);
unregister_netdevice
(
dev
);
free_netdev
(
dev
);
}
return
ret
;
return
ret
;
}
}
static
int
__devinit
saa9730_init_one
(
struct
pci_dev
*
pdev
,
const
struct
pci_device_id
*
ent
)
static
int
__devinit
saa9730_init_one
(
struct
pci_dev
*
pdev
,
const
struct
pci_device_id
*
ent
)
{
{
struct
net_device
*
dev
=
NULL
;
struct
net_device
*
dev
;
unsigned
int
pci_ioaddr
;
unsigned
int
pci_ioaddr
;
int
err
;
int
err
;
if
(
lan_saa9730_debug
>
1
)
if
(
lan_saa9730_debug
>
1
)
printk
(
"saa9730.c: PCI bios is present, checking for devices...
\n
"
);
printk
(
"saa9730.c: PCI bios is present, checking for devices...
\n
"
);
err
=
-
ENOMEM
;
dev
=
alloc_etherdev
(
0
);
if
(
!
dev
)
goto
out
;
SET_MODULE_OWNER
(
dev
);
err
=
pci_enable_device
(
pdev
);
err
=
pci_enable_device
(
pdev
);
if
(
err
)
{
if
(
err
)
{
printk
(
KERN_ERR
"Cannot enable PCI device, aborting.
\n
"
);
printk
(
KERN_ERR
"Cannot enable PCI device, aborting.
\n
"
);
goto
out
;
goto
out
1
;
}
}
err
=
pci_request_regions
(
pdev
,
DRV_MODULE_NAME
);
err
=
pci_request_regions
(
pdev
,
DRV_MODULE_NAME
);
if
(
err
)
{
if
(
err
)
{
printk
(
KERN_ERR
"Cannot obtain PCI resources, aborting.
\n
"
);
printk
(
KERN_ERR
"Cannot obtain PCI resources, aborting.
\n
"
);
goto
out
_disable_pdev
;
goto
out
2
;
}
}
pci_irq_line
=
pdev
->
irq
;
pci_irq_line
=
pdev
->
irq
;
/* LAN base address in located at BAR 1. */
/* LAN base address in located at BAR 1. */
pci_ioaddr
=
pci_resource_start
(
pdev
,
1
);
pci_ioaddr
=
pci_resource_start
(
pdev
,
1
);
pci_set_master
(
pdev
);
pci_set_master
(
pdev
);
printk
(
"Found SAA9730 (PCI) at %#x, irq %d.
\n
"
,
printk
(
"Found SAA9730 (PCI) at %#x, irq %d.
\n
"
,
pci_ioaddr
,
pci_irq_line
);
pci_ioaddr
,
pci_irq_line
);
err
=
lan_saa9730_init
(
dev
,
pci_ioaddr
,
pci_irq_line
);
err
=
lan_saa9730_init
(
dev
,
pci_ioaddr
,
pci_irq_line
);
if
(
err
)
{
if
(
err
)
{
printk
(
"Lan init failed"
);
printk
(
"Lan init failed"
);
goto
out
_disable_pdev
;
goto
out
2
;
}
}
pci_set_drvdata
(
pdev
,
dev
);
pci_set_drvdata
(
pdev
,
dev
);
return
0
;
return
0
;
out_disable_pdev
:
out2
:
pci_disable_device
(
pdev
);
pci_disable_device
(
pdev
);
out:
out1:
pci_set_drvdata
(
pdev
,
NULL
);
free_netdev
(
dev
);
out:
return
err
;
return
err
;
}
}
...
...
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