comedi: ni_routing: tools: Check when the file could not be opened
BugLink: https://bugs.launchpad.net/bugs/2097301 [ Upstream commit 5baeb157b341b1d26a5815aeaa4d3bb9e0444fda ] - After fopen check NULL before using the file pointer use Signed-off-by: Ruffalo Lavoisier <RuffaloLavoisier@gmail.com> Link: https://lore.kernel.org/r/20240906203025.89588-1-RuffaloLavoisier@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
This commit is contained in:
committed by
Mehmet Basaran
parent
4dfebfcd3f
commit
2fcb12542c
@@ -140,6 +140,11 @@ int main(void)
|
||||
{
|
||||
FILE *fp = fopen("ni_values.py", "w");
|
||||
|
||||
if (fp == NULL) {
|
||||
fprintf(stderr, "Could not open file!");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* write route register values */
|
||||
fprintf(fp, "ni_route_values = {\n");
|
||||
for (int i = 0; ni_all_route_values[i]; ++i)
|
||||
|
||||
Reference in New Issue
Block a user