[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240906115402.30894-1-RuffaloLavoisier@gmail.com>
Date: Fri, 6 Sep 2024 20:54:02 +0900
From: Ruffalo Lavoisier <ruffalolavoisier@...il.com>
To: Ian Abbott <abbotti@....co.uk>,
H Hartley Sweeten <hsweeten@...ionengravers.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ruffalo Lavoisier <RuffaloLavoisier@...il.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] ni_routing: Check when the file could not be opened
Signed-off-by: Ruffalo Lavoisier <RuffaloLavoisier@...il.com>
---
drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c b/drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c
index d55521b5bdcb..d0321a7565c5 100644
--- a/drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c
+++ b/drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c
@@ -139,6 +139,10 @@ void device_write(const struct ni_device_routes *dR, FILE *fp)
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");
--
2.43.0
Powered by blists - more mailing lists