Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1379908

Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings

From Emil Velikov <emil.l.velikov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings
Date 2016-04-15 17:20 +0200
Message-ID <rodHj-535-3@gated-at.bofh.it> (permalink)
References <ro6cO-7AZ-17@gated-at.bofh.it> <ro7BU-dt-9@gated-at.bofh.it> <rocUW-4mc-31@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 15 April 2016 at 15:20, Julia Lawall <julia.lawall@lip6.fr> wrote:
> On Fri, 15 Apr 2016, Christian König wrote:
>> 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.
>
> I don't know if it is documented.  Joe Perches suggested that on the right
> was better in general - maybe he knows if this is written somewhere.
>
> There are 504 occurrences of NULL == in the kernel, and 19524 occurrences
> of == NULL.
>
To throw in some more numbers:

From drivers/gpu/drm/amd/ - ~40 for "NULL *== *" and ~400 for " *== *NULL" ;-)

-Emil

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2016-04-15 09:20 +0200
  Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings Christian König <christian.koenig@amd.com> - 2016-04-15 10:50 +0200
    Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings Julia Lawall <julia.lawall@lip6.fr> - 2016-04-15 16:30 +0200
      Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings Emil Velikov <emil.l.velikov@gmail.com> - 2016-04-15 17:20 +0200
      Re: [PATCH] drm/amdgpu: fix compare_const_fl.cocci warnings Joe Perches <joe@perches.com> - 2016-04-15 18:00 +0200

csiph-web