Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Senna Tschudin <peter.senna@linux.intel.com>
To: "Kamil Konieczny" <kamil.konieczny@linux.intel.com>,
	igt-dev@lists.freedesktop.org,
	"Helen Koike" <helen.koike@collabora.com>,
	"Jani Nikula" <jani.nikula@linux.intel.com>,
	"Jani Saarinen" <jani.saarinen@intel.com>,
	"Janusz Krzysztofik" <janusz.krzysztofik@linux.intel.com>,
	"Juha-Pekka Heikkila" <juha-pekka.heikkila@intel.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Melissa Wen" <mwen@igalia.com>,
	"Petri Latvala" <adrinael@adrinael.net>,
	"Rob Clark" <robdclark@chromium.org>,
	"Ryszard Knop" <ryszard.knop@intel.com>,
	"Swati Sharma" <swati2.sharma@intel.com>,
	"Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	dominik.karol.piatkowski@intel.com,
	himal.prasad.ghimiray@intel.com, katarzyna.piecielska@intel.com,
	luciano.coelho@intel.com, nirmoy.das@intel.com,
	stuart.summers@intel.com
Subject: Re: [PATCH i-g-t v14 resend 1/3] lib/igt_facts: Library and unit testing for fact tracking
Date: Tue, 21 Jan 2025 09:16:19 +0100	[thread overview]
Message-ID: <23457bf4-ee02-4da4-8c98-33866bdb56a7@linux.intel.com> (raw)
In-Reply-To: <20241219124015.57unqsj6kiun3bff@kamilkon-desk.igk.intel.com>


Hi Kamil,


On 19.12.2024 13:40, Kamil Konieczny wrote:
> Hi Peter,
> On 2024-12-16 at 16:14:18 +0100, Peter Senna Tschudin wrote:
> 
> I have few nits about a code, I checked it with checkpatch.pl
> and looks like some warnings are left, why not removing them?
> Here are some found by it:
> 
> 0001-lib-igt_facts-Library-and-unit-testing-for-fact-trac.patch:824: CHECK:COMPARISON_TO_NULL: Comparison to NULL could be written "fact"
> #824: FILE: lib/igt_facts.c:736:
> +       igt_assert(fact != NULL);
> 
> 0001-lib-igt_facts-Library-and-unit-testing-for-fact-trac.patch:825: CHECK:BOOL_COMPARISON: Using comparison to true is error prone
> #825: FILE: lib/igt_facts.c:737:
> +       igt_assert(fact->present == true);

There is a very important detail here. It is error prone only when
the type is not bool. My code is not error prone.


> 
> 0001-lib-igt_facts-Library-and-unit-testing-for-fact-trac.patch:913: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations
> #913: FILE: lib/igt_facts.h:40:
> +};
> +extern struct igt_facts_config igt_facts_config;

Good catch, thank you.

> 
> total: 0 errors, 3 warnings, 23 checks, 858 lines checked
> 
> 0001-lib-igt_facts-Library-and-unit-testing-for-fact-trac.patch has style problems, please review.
> 
> Especially when there are many it is easy to overlook an issue,
> one such is comparision with 'true', I searched your code for '== true'
> and one place needs fixing:
> 
> grep -n '== true' lib/igt_facts.c
> 680:    igt_assert(ret == true);
> 690:    igt_assert(fact->present == true);
> 733:    igt_assert(fact->present == true);
> 737:    igt_assert(fact->present == true);
> 769:    igt_assert(igt_list_empty(&igt_facts_list_pci_gpu_head) == true);
> 
> Last line may be an issue, as sometimes pointer comparision could
> be implemented in runtime as 'return (src - dest)' so please fix all
> using template:

I don't think so as the type is bool. I can't imagine a way to make this go
wrong. Can you give me an example showing how a bool type can be evaluated
incorrectly? What am I missing here?

> 
> igt_assert(val == true); --> igt_assert(val);
> 
> In summary, please fix BOOL_COMPARISON, COMPARISON_TO_NULL,
> LINE_SPACING, PARENTHESIS_ALIGNMENT.
> 
> Please remove extern from header, it is not needed:
> 
> extern struct igt_facts_config igt_facts_config;

yep yep, this is twice on the email...

[...]

  reply	other threads:[~2025-01-21  8:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-16 15:14 [PATCH i-g-t v14 resend 0/3] igt_facts for fact tracking Peter Senna Tschudin
2024-12-16 15:14 ` [PATCH i-g-t v14 resend 1/3] lib/igt_facts: Library and unit testing " Peter Senna Tschudin
2024-12-19 12:40   ` Kamil Konieczny
2025-01-21  8:16     ` Peter Senna Tschudin [this message]
2025-01-21 11:52       ` Kamil Konieczny
2024-12-20  8:50   ` Kamil Konieczny
2024-12-16 15:14 ` [PATCH i-g-t v14 resend 2/3] tools/lsfacts: Add tool for listing facts Peter Senna Tschudin
2024-12-16 15:14 ` [PATCH i-g-t v14 resend 3/3] runner/executor: Integrate igt_facts functionality Peter Senna Tschudin
2024-12-16 21:40 ` ✗ i915.CI.BAT: failure for igt_facts for fact tracking (rev2) Patchwork
2024-12-17  5:12   ` Peter Senna Tschudin
2024-12-17 13:58     ` Ravali, JupallyX
2024-12-17  0:00 ` ✓ Xe.CI.BAT: success " Patchwork
2024-12-17  4:17 ` ✗ Xe.CI.Full: failure " Patchwork
2024-12-17  5:14   ` Peter Senna Tschudin
2024-12-17  9:33 ` ✓ i915.CI.BAT: success " Patchwork
2024-12-17 14:25 ` ✗ i915.CI.Full: failure " Patchwork
2024-12-18  5:18   ` Peter Senna Tschudin
2024-12-19  4:56     ` Peter Senna Tschudin
2024-12-19  7:28     ` Ravali, JupallyX
2024-12-19  7:18 ` ✓ i915.CI.Full: success " Patchwork

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=23457bf4-ee02-4da4-8c98-33866bdb56a7@linux.intel.com \
    --to=peter.senna@linux.intel.com \
    --cc=adrinael@adrinael.net \
    --cc=dominik.karol.piatkowski@intel.com \
    --cc=helen.koike@collabora.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=jani.saarinen@intel.com \
    --cc=janusz.krzysztofik@linux.intel.com \
    --cc=juha-pekka.heikkila@intel.com \
    --cc=kamil.konieczny@linux.intel.com \
    --cc=katarzyna.piecielska@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=luciano.coelho@intel.com \
    --cc=mcanal@igalia.com \
    --cc=mwen@igalia.com \
    --cc=nirmoy.das@intel.com \
    --cc=robdclark@chromium.org \
    --cc=ryszard.knop@intel.com \
    --cc=stuart.summers@intel.com \
    --cc=swati2.sharma@intel.com \
    --cc=zbigniew.kempczynski@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox