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
7ac8e36e
Commit
7ac8e36e
authored
Jan 22, 2004
by
Dave Jones
Committed by
Linus Torvalds
Jan 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] Reduce stack usage in w9966 driver.
2KB onstack allocation. Nasty.
parent
fd036b30
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
drivers/media/video/w9966.c
drivers/media/video/w9966.c
+16
-7
No files found.
drivers/media/video/w9966.c
View file @
7ac8e36e
...
@@ -875,6 +875,7 @@ static ssize_t w9966_v4l_read(struct file *file, char *buf,
...
@@ -875,6 +875,7 @@ static ssize_t w9966_v4l_read(struct file *file, char *buf,
unsigned
char
addr
=
0xa0
;
// ECP, read, CCD-transfer, 00000
unsigned
char
addr
=
0xa0
;
// ECP, read, CCD-transfer, 00000
unsigned
char
*
dest
=
(
unsigned
char
*
)
buf
;
unsigned
char
*
dest
=
(
unsigned
char
*
)
buf
;
unsigned
long
dleft
=
count
;
unsigned
long
dleft
=
count
;
unsigned
char
*
tbuf
;
// Why would anyone want more than this??
// Why would anyone want more than this??
if
(
count
>
cam
->
width
*
cam
->
height
*
2
)
if
(
count
>
cam
->
width
*
cam
->
height
*
2
)
...
@@ -895,24 +896,32 @@ static ssize_t w9966_v4l_read(struct file *file, char *buf,
...
@@ -895,24 +896,32 @@ static ssize_t w9966_v4l_read(struct file *file, char *buf,
return
-
EFAULT
;
return
-
EFAULT
;
}
}
tbuf
=
kmalloc
(
W9966_RBUFFER
,
GFP_KERNEL
);
if
(
tbuf
==
NULL
)
{
count
=
-
ENOMEM
;
goto
out
;
}
while
(
dleft
>
0
)
while
(
dleft
>
0
)
{
{
unsigned
long
tsize
=
(
dleft
>
W9966_RBUFFER
)
?
W9966_RBUFFER
:
dleft
;
unsigned
long
tsize
=
(
dleft
>
W9966_RBUFFER
)
?
W9966_RBUFFER
:
dleft
;
unsigned
char
tbuf
[
W9966_RBUFFER
];
if
(
parport_read
(
cam
->
pport
,
tbuf
,
tsize
)
<
tsize
)
{
if
(
parport_read
(
cam
->
pport
,
tbuf
,
tsize
)
<
tsize
)
{
w9966_pdev_release
(
cam
)
;
count
=
-
EFAULT
;
return
-
EFAULT
;
goto
out
;
}
}
if
(
copy_to_user
(
dest
,
tbuf
,
tsize
)
!=
0
)
{
if
(
copy_to_user
(
dest
,
tbuf
,
tsize
)
!=
0
)
{
w9966_pdev_release
(
cam
)
;
count
=
-
EFAULT
;
return
-
EFAULT
;
goto
out
;
}
}
dest
+=
tsize
;
dest
+=
tsize
;
dleft
-=
tsize
;
dleft
-=
tsize
;
}
}
w9966_wReg
(
cam
,
0x01
,
0x18
);
// Disable capture
w9966_wReg
(
cam
,
0x01
,
0x18
);
// Disable capture
out:
kfree
(
tbuf
);
w9966_pdev_release
(
cam
);
w9966_pdev_release
(
cam
);
return
count
;
return
count
;
...
...
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