Linux Perf Users
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: GuoHan Zhao <zhaoguohan@kylinos.cn>, linux-perf-users@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ian Rogers <irogers@google.com>, Ingo Molnar <mingo@redhat.com>,
	Jiri Olsa <jolsa@kernel.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v3] perf drm_pmu: fix fd_dir leaks in for_each_drm_fdinfo_in_dir()
Date: Mon, 8 Sep 2025 10:02:00 +0200	[thread overview]
Message-ID: <947f8359-6380-4285-a593-55b3414ea86d@web.de> (raw)
In-Reply-To: <20250908065203.22187-1-zhaoguohan@kylinos.cn>

> Fix file descriptor leak when callback function returns error. The
…

Would it be nicer to move the last word into the next text line?


…> +++ b/tools/perf/util/drm_pmu.c
> @@ -458,8 +458,10 @@ static int for_each_drm_fdinfo_in_dir(int (*cb)(void *args, int fdinfo_dir_fd, c
>  		}
>  		ret = cb(args, fdinfo_dir_fd, fd_entry->d_name);
…> +close_fdinfo:
>  	if (fdinfo_dir_fd != -1)

May a repeated check be avoided here?


>  		close(fdinfo_dir_fd);

How do you think about to use such a label directly before
the function call?


>  	closedir(fd_dir);


Regards,
Markus

  reply	other threads:[~2025-09-08  8:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-08  6:52 [PATCH v3] perf drm_pmu: fix fd_dir leaks in for_each_drm_fdinfo_in_dir() zhaoguohan
2025-09-08  8:02 ` Markus Elfring [this message]
2025-09-12 18:26 ` Arnaldo Carvalho de Melo

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=947f8359-6380-4285-a593-55b3414ea86d@web.de \
    --to=markus.elfring@web.de \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=zhaoguohan@kylinos.cn \
    /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