linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Christian König" <christian.koenig@amd.com>
To: Julia Lawall <julia.lawall@lip6.fr>, Dave Airlie <airlied@redhat.com>
Cc: <kbuild-all@01.org>, Alex Deucher <alexander.deucher@amd.com>,
	<dri-devel@lists.freedesktop.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings
Date: Fri, 15 Apr 2016 10:46:11 +0200	[thread overview]
Message-ID: <5710AA53.7070307@amd.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1604150914040.2061@localhost6.localdomain6>

Am 15.04.2016 um 09:15 schrieb Julia Lawall:
> Move constants to the right of binary operators.
>
> Generated by: scripts/coccinelle/misc/compare_const_fl.cocci
>
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> Signed-off-by: Julia Lawall <julia.lawall@lip6.fr>

In general the patch looks ok, but do we have a documented preference 
where to place constants in the coding style docs?

While it's not so much of a problem any more with modern compilers, some 
people still prefer to have it on the left side to catch accidental 
value assignments.

Regards,
Christian.

> ---
>
> Could be nice to put the thing being tested first.
>
>   amdgpu_grph_object_id_helpers.c |    4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_grph_object_id_helpers.c
> @@ -169,11 +169,11 @@ struct graphics_object_id amdgpu_object_
>   	struct graphics_object_id go_id = { 0 };
>   
>   	type = object_type_from_bios_object_id(bios_object_id);
> -	if (OBJECT_TYPE_UNKNOWN == type)
> +	if (type == OBJECT_TYPE_UNKNOWN)
>   		return go_id;
>   
>   	enum_id = enum_id_from_bios_object_id(bios_object_id);
> -	if (ENUM_ID_UNKNOWN == enum_id)
> +	if (enum_id == ENUM_ID_UNKNOWN)
>   		return go_id;
>   
>   	go_id = display_graphics_object_id_init(

  reply	other threads:[~2016-04-15  8:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-15  7:15 [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings Julia Lawall
2016-04-15  8:46 ` Christian König [this message]
2016-04-15 14:20   ` Julia Lawall
2016-04-15 15:14     ` Emil Velikov
2016-04-15 15:50     ` Joe Perches

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=5710AA53.7070307@amd.com \
    --to=christian.koenig@amd.com \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=julia.lawall@lip6.fr \
    --cc=kbuild-all@01.org \
    --cc=linux-kernel@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).