From: Ruffalo Lavoisier <ruffalolavoisier@gmail.com>
To: Ian Abbott <abbotti@mev.co.uk>,
H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Ruffalo Lavoisier <RuffaloLavoisier@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] ni_routing: Check when the file could not be opened
Date: Fri, 6 Sep 2024 21:32:21 +0900 [thread overview]
Message-ID: <20240906123222.32006-1-RuffaloLavoisier@gmail.com> (raw)
Signed-off-by: Ruffalo Lavoisier <RuffaloLavoisier@gmail.com>
---
I'm sorry. I think it's dirty because I'm not used to the patch. I'm going to write it all over again and send it to you.
This is just a defense code just in case.
drivers/comedi/drivers/ni_routing/tools/convert_c_to_py.c | 5 +++++
1 file changed, 5 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..892a66b2cea6 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
@@ -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)
--
2.43.0
next reply other threads:[~2024-09-06 12:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 12:32 Ruffalo Lavoisier [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-09-06 11:54 [PATCH] ni_routing: Check when the file could not be opened Ruffalo Lavoisier
2024-09-06 11:59 ` Greg Kroah-Hartman
2024-09-05 14:42 Ruffalo Lavoisier
2024-09-06 10:43 ` Ian Abbott
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=20240906123222.32006-1-RuffaloLavoisier@gmail.com \
--to=ruffalolavoisier@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=gregkh@linuxfoundation.org \
--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