Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci-2.6.23
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci-2.6.23
Commits
3a781f21
Commit
3a781f21
authored
Nov 20, 2009
by
Jean-Paul Saman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
davinci_vpfe: extra safety checks
parent
e316b56c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
drivers/media/video/davinci_vpfe.c
drivers/media/video/davinci_vpfe.c
+12
-5
No files found.
drivers/media/video/davinci_vpfe.c
View file @
3a781f21
...
@@ -264,19 +264,19 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
...
@@ -264,19 +264,19 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
for
(
i
=
VPFE_DEFNUM_FBUFS
;
i
<
*
count
;
i
++
)
for
(
i
=
VPFE_DEFNUM_FBUFS
;
i
<
*
count
;
i
++
)
{
{
u32
size
=
PAGE_SIZE
<<
VPFE_MAX_FBUF_ORDER
;
u32
buf
size
=
PAGE_SIZE
<<
VPFE_MAX_FBUF_ORDER
;
void
*
mem
=
(
void
*
)
__get_free_pages
(
GFP_KERNEL
|
GFP_DMA
,
void
*
mem
=
(
void
*
)
__get_free_pages
(
GFP_KERNEL
|
GFP_DMA
,
VPFE_MAX_FBUF_ORDER
);
VPFE_MAX_FBUF_ORDER
);
if
(
mem
)
if
(
mem
)
{
{
unsigned
long
adr
=
(
unsigned
long
)
mem
;
unsigned
long
adr
=
(
unsigned
long
)
mem
;
while
(
size
>
0
)
while
(
buf
size
>
0
)
{
{
/* make sure the frame buffers are never
/* make sure the frame buffers are never
swapped out of memory */
swapped out of memory */
SetPageReserved
(
virt_to_page
(
adr
));
SetPageReserved
(
virt_to_page
(
adr
));
adr
+=
PAGE_SIZE
;
adr
+=
PAGE_SIZE
;
size
-=
PAGE_SIZE
;
buf
size
-=
PAGE_SIZE
;
}
}
vpfe
->
fbuffers
[
i
]
=
mem
;
vpfe
->
fbuffers
[
i
]
=
mem
;
}
}
...
@@ -301,7 +301,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
...
@@ -301,7 +301,7 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
static
void
buffer_release
(
struct
videobuf_queue
*
q
,
struct
videobuf_buffer
*
vb
)
static
void
buffer_release
(
struct
videobuf_queue
*
q
,
struct
videobuf_buffer
*
vb
)
{
{
/* free the buffer if it is not one of the 3 allocated at initializa
it
on time */
/* free the buffer if it is not one of the 3 allocated at initializa
ti
on time */
if
(
vb
->
i
<
vpfe_device
.
numbuffers
if
(
vb
->
i
<
vpfe_device
.
numbuffers
&&
vb
->
i
>=
VPFE_DEFNUM_FBUFS
&&
vb
->
i
>=
VPFE_DEFNUM_FBUFS
&&
vpfe_device
.
fbuffers
[
vb
->
i
])
&&
vpfe_device
.
fbuffers
[
vb
->
i
])
...
@@ -969,12 +969,17 @@ static int vpfe_doioctl(struct inode *inode, struct file *file,
...
@@ -969,12 +969,17 @@ static int vpfe_doioctl(struct inode *inode, struct file *file,
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
break
;
break
;
}
}
flush_scheduled_work
();
/* disable CCDC */
/* disable CCDC */
down_interruptible
(
&
vpfe
->
lock
);
down_interruptible
(
&
vpfe
->
lock
);
ccdc_enable
(
FALSE
);
ccdc_enable
(
FALSE
);
vpfe
->
io_usrs
=
0
;
vpfe
->
started
=
FALSE
;
vpfe
->
started
=
FALSE
;
up
(
&
vpfe
->
lock
);
up
(
&
vpfe
->
lock
);
ret
=
videobuf_streamoff
(
&
vpfe
->
bufqueue
);
ret
=
videobuf_streamoff
(
&
vpfe
->
bufqueue
);
debug_print
(
KERN_INFO
"stopped video streaming.
\n
"
);
break
;
break
;
}
}
case
VPFE_CMD_CONFIG_CCDC
:
case
VPFE_CMD_CONFIG_CCDC
:
...
@@ -1124,8 +1129,10 @@ static int vpfe_release(struct inode *inode, struct file *filep)
...
@@ -1124,8 +1129,10 @@ static int vpfe_release(struct inode *inode, struct file *filep)
vpfe_fh
*
fh
=
filep
->
private_data
;
vpfe_fh
*
fh
=
filep
->
private_data
;
vpfe_obj
*
vpfe
=
fh
->
dev
;
vpfe_obj
*
vpfe
=
fh
->
dev
;
flush_scheduled_work
();
down_interruptible
(
&
vpfe
->
lock
);
down_interruptible
(
&
vpfe
->
lock
);
if
(
fh
->
io_allowed
)
if
(
fh
->
io_allowed
&&
vpfe
->
started
&&
vpfe
->
io_usrs
!=
0
)
{
{
vpfe
->
io_usrs
=
0
;
vpfe
->
io_usrs
=
0
;
ccdc_enable
(
FALSE
);
ccdc_enable
(
FALSE
);
...
...
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