From: Ruffalo Lavoisier <ruffalolavoisier@gmail.com>
To: Ian Abbott <abbotti@mev.co.uk>,
H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ruffalo Lavoisier <RuffaloLavoisier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] ni_routing: Check when the file could not be opened
Date: Thu, 5 Sep 2024 23:42:12 +0900 [thread overview]
Message-ID: <20240905144213.8954-1-RuffaloLavoisier@gmail.com> (raw)
Signed-off-by: Ruffalo Lavoisier <RuffaloLavoisier@gmail.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
next reply other threads:[~2024-09-05 14:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-05 14:42 Ruffalo Lavoisier [this message]
2024-09-06 10:43 ` [PATCH] ni_routing: Check when the file could not be opened Ian Abbott
-- strict thread matches above, loose matches on Subject: below --
2024-09-06 11:54 Ruffalo Lavoisier
2024-09-06 11:59 ` Greg Kroah-Hartman
2024-09-06 12:32 Ruffalo Lavoisier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240905144213.8954-1-RuffaloLavoisier@gmail.com \
--to=ruffalolavoisier@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox