Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FMC TDC 1ns 5cha
Commits
f366e985
Commit
f366e985
authored
Dec 15, 2022
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw: fix to cppcheck/flawfinder reports
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
bbfa8738
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
14 deletions
+15
-14
fmctdc-lib-private.h
software/lib/fmctdc-lib-private.h
+3
-3
fmctdc-lib.c
software/lib/fmctdc-lib.c
+3
-4
fmc-tdc-calibration.c
software/tools/fmc-tdc-calibration.c
+2
-2
fmc-tdc-offset.c
software/tools/fmc-tdc-offset.c
+1
-1
fmc-tdc-perftest.c
software/tools/fmc-tdc-perftest.c
+1
-1
fmc-tdc-term.c
software/tools/fmc-tdc-term.c
+3
-2
fmc-tdc-time.c
software/tools/fmc-tdc-time.c
+2
-1
No files found.
software/lib/fmctdc-lib-private.h
View file @
f366e985
...
...
@@ -62,7 +62,7 @@ static inline int __fmctdc_sysfs_set(char *path, uint32_t * value)
char
s
[
16
];
int
fd
,
ret
,
len
;
len
=
s
printf
(
s
,
"%u
\n
"
,
*
value
);
len
=
s
nprintf
(
s
,
sizeof
(
s
)
,
"%u
\n
"
,
*
value
);
fd
=
open
(
path
,
O_WRONLY
);
if
(
fd
<
0
)
return
-
1
;
...
...
@@ -82,7 +82,7 @@ static inline int fmctdc_sysfs_get(struct __fmctdc_board *b, char *name,
{
char
pathname
[
128
];
s
printf
(
pathname
,
"%s/%s"
,
b
->
sysbase
,
name
);
s
nprintf
(
pathname
,
sizeof
(
pathname
)
,
"%s/%s"
,
b
->
sysbase
,
name
);
return
__fmctdc_sysfs_get
(
pathname
,
resp
);
}
...
...
@@ -91,7 +91,7 @@ static inline int fmctdc_sysfs_set(struct __fmctdc_board *b, char *name,
{
char
pathname
[
128
];
s
printf
(
pathname
,
"%s/%s"
,
b
->
sysbase
,
name
);
s
nprintf
(
pathname
,
sizeof
(
pathname
)
,
"%s/%s"
,
b
->
sysbase
,
name
);
return
__fmctdc_sysfs_set
(
pathname
,
value
);
}
...
...
software/lib/fmctdc-lib.c
View file @
f366e985
...
...
@@ -128,7 +128,7 @@ struct fmctdc_board *fmctdc_open(int dev_id)
goto
err_stat_d
;
if
(
!
S_ISCHR
(
sb
.
st_mode
))
goto
err_stat_d
;
b
->
devbase
=
strndup
(
path
,
str
len
(
path
)
-
strlen
(
"-0-0-ctrl"
));
b
->
devbase
=
strndup
(
path
,
str
nlen
(
path
,
sizeof
(
path
))
-
9
);
// +9 -0-0-ctrl
if
(
!
b
->
sysbase
)
goto
err_dup_dev
;
...
...
@@ -213,11 +213,10 @@ struct fmctdc_board *fmctdc_open_by_lun(int lun)
{
ssize_t
ret
;
char
dev_id_str
[
4
];
char
path_pattern
[]
=
"/dev/tdc-1n5c.%d"
;
char
path
[
sizeof
(
path_pattern
)
+
1
];
char
path
[
32
];
uint32_t
dev_id
;
ret
=
snprintf
(
path
,
sizeof
(
path
),
path_pattern
,
lun
);
ret
=
snprintf
(
path
,
sizeof
(
path
),
"/dev/tdc-1n5c.%d"
,
lun
);
if
(
ret
<
0
||
ret
>=
sizeof
(
path
))
{
errno
=
EINVAL
;
return
NULL
;
...
...
software/tools/fmc-tdc-calibration.c
View file @
f366e985
...
...
@@ -125,7 +125,7 @@ static int fau_calibration_write(unsigned int devid,
int
ret
;
int
i
;
s
printf
(
path
,
s
nprintf
(
path
,
sizeof
(
path
)
,
"/sys/bus/zio/devices/tdc-1n5c-%04x/calibration_data"
,
devid
);
...
...
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
switch
(
c
)
{
default:
case
'h'
:
fp
rintf
(
stderr
,
help_msg
);
fp
uts
(
help_msg
,
stderr
);
exit
(
EXIT_SUCCESS
);
case
'D'
:
ret
=
sscanf
(
optarg
,
"0x%x"
,
&
devid
);
...
...
software/tools/fmc-tdc-offset.c
View file @
f366e985
...
...
@@ -24,7 +24,7 @@ int main(int argc, char **argv)
if
(
argc
>=
3
)
{
channel
=
atoi
(
argv
[
2
]
);
sscanf
(
argv
[
2
],
"%i"
,
&
channel
);
if
(
channel
<
FMCTDC_CH_1
||
channel
>
FMCTDC_CH_LAST
)
{
fprintf
(
stderr
,
"%s: invalid channel.
\n
"
,
argv
[
0
]);
return
-
1
;
...
...
software/tools/fmc-tdc-perftest.c
View file @
f366e985
...
...
@@ -355,7 +355,7 @@ int main(int argc, char **argv)
free
(
ts
);
out:
ret
=
fmctdc_channel_disable
(
brd
,
channel
);
fmctdc_channel_disable
(
brd
,
channel
);
fmctdc_close
(
brd
);
exit
(
EXIT_SUCCESS
);
}
software/tools/fmc-tdc-term.c
View file @
f366e985
...
...
@@ -13,6 +13,8 @@ char git_version[] = "git version: " GIT_VERSION;
int
main
(
int
argc
,
char
**
argv
)
{
int
channel
;
init
(
argc
,
argv
);
check_help
(
argc
,
argv
,
2
,
...
...
@@ -31,8 +33,7 @@ int main(int argc, char **argv)
return
0
;
}
int
channel
=
atoi
(
argv
[
2
]);
sscanf
(
argv
[
2
],
"%i"
,
&
channel
);
if
(
channel
<
FMCTDC_CH_1
||
channel
>
FMCTDC_CH_LAST
)
{
fprintf
(
stderr
,
"%s: invalid channel.
\n
"
,
argv
[
0
]);
return
-
1
;
...
...
software/tools/fmc-tdc-time.c
View file @
f366e985
...
...
@@ -23,6 +23,7 @@ int main(int argc, char **argv)
char
*
cmd
;
init
(
argc
,
argv
);
memset
(
&
ts
,
0
,
sizeof
(
ts
));
check_help
(
argc
,
argv
,
3
,
"[-h] [-V] <device> <command> [timeval]"
,
...
...
@@ -63,7 +64,7 @@ int main(int argc, char **argv)
}
ts
.
coarse
=
0
;
ts
.
seconds
=
atoi
(
argv
[
3
]
);
sscanf
(
argv
[
3
],
"%"
SCNu64
,
&
ts
.
seconds
);
if
(
fmctdc_set_time
(
brd
,
&
ts
)
<
0
)
{
perror_hint
(
"fmctdc_set_time()"
);
...
...
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