All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Rostyslav Lobov <rostislavlobov.k@gmail.com>
Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: Remove useless code in example [libgpiod]
Date: Wed, 26 Mar 2025 12:17:07 +0800	[thread overview]
Message-ID: <20250326041707.GA62833@rigel> (raw)
In-Reply-To: <34108b89c6fe4ab05b65a0688a3d3e3742371074.camel@gmail.com>

On Mon, Mar 24, 2025 at 11:23:17PM -0400, Rostyslav Lobov wrote:
> 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

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

The patch makes sense, that code looks like a leftover from a cut-and-paste,
but please re-submit as per the CONTRIBUTING section of the README.

Cheers,
Kent.

  reply	other threads:[~2025-03-26  4:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25  3:23 Remove useless code in example [libgpiod] Rostyslav Lobov
2025-03-26  4:17 ` Kent Gibson [this message]
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=20250326041707.GA62833@rigel \
    --to=warthog618@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=linux-gpio@vger.kernel.org \
    --cc=rostislavlobov.k@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.