Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1672780 > unrolled thread
| Started by | Joe Perches <joe@perches.com> |
|---|---|
| First post | 2017-06-22 18:10 +0200 |
| Last post | 2017-06-23 09:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects Joe Perches <joe@perches.com> - 2017-06-22 18:10 +0200
Re: [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects Laurentiu Tudor <laurentiu.tudor@nxp.com> - 2017-06-23 09:30 +0200
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-06-22 18:10 +0200 |
| Subject | Re: [PATCH 01/14] staging: fsl-mc: drop macros with possible side effects |
| Message-ID | <tVcQb-74p-27@gated-at.bofh.it> |
On Thu, 2017-06-22 at 16:35 +0300, laurentiu.tudor@nxp.com wrote:
> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>
> Several macros were triggering this checkpatch.pl warning:
> "Macro argument reuse '$arg' - possible side-effects?"
> Fix the warning by turning them into real functions.
good idea and
> diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c
[]
> +static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev,
> + struct dprc_obj_desc *obj_desc)
> +{
> + return !strcmp(mc_dev->obj_desc.type, obj_desc->type) &&
> + mc_dev->obj_desc.id == obj_desc->id;
> +}
I'd reverse the test order and do the strcmp after the comparison
return mc_dev->obj_desc.id == obj_desc->id &&
!strcmp(mc_dev->obj_desc.type, obj_desc->type);
[]
> +static bool __must_check fsl_mc_is_allocatable(const char *obj_type)
> +{
> + return strcmp(obj_type, "dpbp") == 0 ||
> + strcmp(obj_type, "dpmcp") == 0 ||
> + strcmp(obj_type, "dpcon") == 0;
> +}
please be consistent in using either == 0 or !
when using strcmp
[toc] | [next] | [standalone]
| From | Laurentiu Tudor <laurentiu.tudor@nxp.com> |
|---|---|
| Date | 2017-06-23 09:30 +0200 |
| Message-ID | <tVrcu-7CL-7@gated-at.bofh.it> |
| In reply to | #1672780 |
Hi Joe,
On 06/22/2017 07:07 PM, Joe Perches wrote:
> On Thu, 2017-06-22 at 16:35 +0300, laurentiu.tudor@nxp.com wrote:
>> From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
>>
>> Several macros were triggering this checkpatch.pl warning:
>> "Macro argument reuse '$arg' - possible side-effects?"
>> Fix the warning by turning them into real functions.
>
> good idea and
>
>> diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c
> []
>> +static bool fsl_mc_device_match(struct fsl_mc_device *mc_dev,
>> + struct dprc_obj_desc *obj_desc)
>> +{
>> + return !strcmp(mc_dev->obj_desc.type, obj_desc->type) &&
>> + mc_dev->obj_desc.id == obj_desc->id;
>> +}
>
> I'd reverse the test order and do the strcmp after the comparison
>
> return mc_dev->obj_desc.id == obj_desc->id &&
> !strcmp(mc_dev->obj_desc.type, obj_desc->type);
>
> []
>
>> +static bool __must_check fsl_mc_is_allocatable(const char *obj_type)
>> +{
>> + return strcmp(obj_type, "dpbp") == 0 ||
>> + strcmp(obj_type, "dpmcp") == 0 ||
>> + strcmp(obj_type, "dpcon") == 0;
>> +}
>
> please be consistent in using either == 0 or !
> when using strcmp
>
Thanks for the suggestions. Will take care of them in the next round.
---
Best Regards, Laurentiu
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web