From: Rostyslav Lobov <rostislavlobov.k@gmail.com>
To: linux-gpio@vger.kernel.org
Subject: Remove useless code in example [libgpiod]
Date: Mon, 24 Mar 2025 23:23:17 -0400 [thread overview]
Message-ID: <34108b89c6fe4ab05b65a0688a3d3e3742371074.camel@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 292 bytes --]
Hello, I noticed that `libgpiod/examples/reconfigure_input_to_output.c`
has some useless declaration `struct gpiod_request_config *req_cfg =
NULL;` and later free `gpiod_request_config_free(req_cfg);` of the
variable which is never used...
So I'm attaching a fix patch.
Rostyslav Lobov
[-- Attachment #2: remove_useless.patch --]
[-- Type: text/x-patch, Size: 779 bytes --]
diff --git a/examples/reconfigure_input_to_output.c b/examples/reconfigure_input_to_output.c
index 451bb0e..734a99c 100644
--- a/examples/reconfigure_input_to_output.c
+++ b/examples/reconfigure_input_to_output.c
@@ -71,7 +71,6 @@ static int reconfigure_as_output_line(struct gpiod_line_request *request,
unsigned int offset,
enum gpiod_line_value value)
{
- struct gpiod_request_config *req_cfg = NULL;
struct gpiod_line_settings *settings;
struct gpiod_line_config *line_cfg;
int ret = -1;
@@ -95,8 +94,6 @@ static int reconfigure_as_output_line(struct gpiod_line_request *request,
ret = gpiod_line_request_reconfigure_lines(request, line_cfg);
- gpiod_request_config_free(req_cfg);
-
free_line_config:
gpiod_line_config_free(line_cfg);
next reply other threads:[~2025-03-25 3:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-25 3:23 Rostyslav Lobov [this message]
2025-03-26 4:17 ` Remove useless code in example [libgpiod] Kent Gibson
2025-03-29 3:18 ` [PATCH] examples: reconfigure_input_to_output: Remove useless variable Rostyslav Lobov
2025-03-31 7:31 ` Bartosz Golaszewski
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=34108b89c6fe4ab05b65a0688a3d3e3742371074.camel@gmail.com \
--to=rostislavlobov.k@gmail.com \
--cc=linux-gpio@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;
as well as URLs for NNTP newsgroup(s).