linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Remove useless code in example [libgpiod]
@ 2025-03-25  3:23 Rostyslav Lobov
  2025-03-26  4:17 ` Kent Gibson
  0 siblings, 1 reply; 4+ messages in thread
From: Rostyslav Lobov @ 2025-03-25  3:23 UTC (permalink / raw)
  To: linux-gpio

[-- 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);
 

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-31  7:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-25  3:23 Remove useless code in example [libgpiod] Rostyslav Lobov
2025-03-26  4:17 ` 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

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).