linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Staging:greybus Fix comparison to NULL
@ 2018-06-03 12:52 Janani Sankara Babu
  2018-06-05  5:32 ` [greybus-dev] " Viresh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Janani Sankara Babu @ 2018-06-03 12:52 UTC (permalink / raw)
  To: gregkh; +Cc: greybus-dev, devel, linux-kernel, Janani Sankara Babu

This patch replaces comparison of var to NULL with !var

Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>
---
 drivers/staging/greybus/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
index dafa430..5d14a4e 100644
--- a/drivers/staging/greybus/core.c
+++ b/drivers/staging/greybus/core.c
@@ -48,7 +48,7 @@ static bool greybus_match_one_id(struct gb_bundle *bundle,
 static const struct greybus_bundle_id *
 greybus_match_id(struct gb_bundle *bundle, const struct greybus_bundle_id *id)
 {
-	if (id == NULL)
+	if (!id)
 		return NULL;

 	for (; id->vendor || id->product || id->class || id->driver_info;
--
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [greybus-dev] [PATCH] Staging:greybus Fix comparison to NULL
  2018-06-03 12:52 [PATCH] Staging:greybus Fix comparison to NULL Janani Sankara Babu
@ 2018-06-05  5:32 ` Viresh Kumar
  2018-06-05  6:10   ` Johan Hovold
  2018-06-05  9:00   ` Dan Carpenter
  0 siblings, 2 replies; 5+ messages in thread
From: Viresh Kumar @ 2018-06-05  5:32 UTC (permalink / raw)
  To: Janani Sankara Babu; +Cc: gregkh, devel, greybus-dev, linux-kernel

On 03-06-18, 08:52, Janani Sankara Babu wrote:
> This patch replaces comparison of var to NULL with !var
> 
> Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>
> ---
>  drivers/staging/greybus/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
> index dafa430..5d14a4e 100644
> --- a/drivers/staging/greybus/core.c
> +++ b/drivers/staging/greybus/core.c
> @@ -48,7 +48,7 @@ static bool greybus_match_one_id(struct gb_bundle *bundle,
>  static const struct greybus_bundle_id *
>  greybus_match_id(struct gb_bundle *bundle, const struct greybus_bundle_id *id)
>  {
> -	if (id == NULL)
> +	if (!id)

It is pretty much personal preference and there is no good reason to accept this
patch really.

-- 
viresh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [greybus-dev] [PATCH] Staging:greybus Fix comparison to NULL
  2018-06-05  5:32 ` [greybus-dev] " Viresh Kumar
@ 2018-06-05  6:10   ` Johan Hovold
  2018-06-05  9:00   ` Dan Carpenter
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Hovold @ 2018-06-05  6:10 UTC (permalink / raw)
  To: Viresh Kumar, Janani Sankara Babu
  Cc: devel, gregkh, linux-kernel, greybus-dev

On Tue, Jun 05, 2018 at 11:02:36AM +0530, Viresh Kumar wrote:
> On 03-06-18, 08:52, Janani Sankara Babu wrote:
> > This patch replaces comparison of var to NULL with !var
> > 
> > Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>
> > ---
> >  drivers/staging/greybus/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
> > index dafa430..5d14a4e 100644
> > --- a/drivers/staging/greybus/core.c
> > +++ b/drivers/staging/greybus/core.c
> > @@ -48,7 +48,7 @@ static bool greybus_match_one_id(struct gb_bundle *bundle,
> >  static const struct greybus_bundle_id *
> >  greybus_match_id(struct gb_bundle *bundle, const struct greybus_bundle_id *id)
> >  {
> > -	if (id == NULL)
> > +	if (!id)
> 
> It is pretty much personal preference and there is no good reason to
> accept this patch really.

I agree with you, Viresh, but greybus is still living in staging which
makes checkpatch enable the --strict option, thereby forcing its authors
preferences onto the rest of us.

I also do understand Greg's point that while --strict is enabled,
rejecting such patches will probably cause some new submitters to do
work for nothing, which is not good.

On the other hand, I at least think we should enforce having a patch
description that clearly indicates that this is just something to make
checkpatch happy (reserving the term "fix" for proper fixes, at least if
not used in conjunction with "checkpatch warning").

So Janani, would you mind resubmitting this patch with a slightly
modified commit message, such as:

	staging: greybus: clean up NULL comparisons

	Replace comparison of var to NULL with !var in order to address
	a checkpatch (strict) warning.

You could also change the sole remaining comparison to NULL in bundle.c
in the same patch.

Thanks,
Johan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [greybus-dev] [PATCH] Staging:greybus Fix comparison to NULL
  2018-06-05  5:32 ` [greybus-dev] " Viresh Kumar
  2018-06-05  6:10   ` Johan Hovold
@ 2018-06-05  9:00   ` Dan Carpenter
  2018-06-05 12:36     ` Alex Elder
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2018-06-05  9:00 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Janani Sankara Babu, devel, gregkh, linux-kernel, greybus-dev

On Tue, Jun 05, 2018 at 11:02:36AM +0530, Viresh Kumar wrote:
> On 03-06-18, 08:52, Janani Sankara Babu wrote:
> > This patch replaces comparison of var to NULL with !var
> > 
> > Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>
> > ---
> >  drivers/staging/greybus/core.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
> > index dafa430..5d14a4e 100644
> > --- a/drivers/staging/greybus/core.c
> > +++ b/drivers/staging/greybus/core.c
> > @@ -48,7 +48,7 @@ static bool greybus_match_one_id(struct gb_bundle *bundle,
> >  static const struct greybus_bundle_id *
> >  greybus_match_id(struct gb_bundle *bundle, const struct greybus_bundle_id *id)
> >  {
> > -	if (id == NULL)
> > +	if (!id)
> 
> It is pretty much personal preference and there is no good reason to accept this
> patch really.

Checkpatch complains, so it's Official Kernel Style now.

The != NULL comparison is a double negative which makes it not less
annoying than official kernel style.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [greybus-dev] [PATCH] Staging:greybus Fix comparison to NULL
  2018-06-05  9:00   ` Dan Carpenter
@ 2018-06-05 12:36     ` Alex Elder
  0 siblings, 0 replies; 5+ messages in thread
From: Alex Elder @ 2018-06-05 12:36 UTC (permalink / raw)
  To: Dan Carpenter, Viresh Kumar, Johan Hovold
  Cc: devel, Janani Sankara Babu, linux-kernel, greybus-dev

On 06/05/2018 04:00 AM, Dan Carpenter wrote:
> On Tue, Jun 05, 2018 at 11:02:36AM +0530, Viresh Kumar wrote:
>> On 03-06-18, 08:52, Janani Sankara Babu wrote:
>>> This patch replaces comparison of var to NULL with !var
>>>
>>> Signed-off-by: Janani Sankara Babu <jananis37@gmail.com>

Wow, such deep discussion for such a trivial patch!

I say we take it, mostly because I personally prefer being
permissive if there's nothing technically wrong with a patch,
but also because I'm swayed by the other comments.

That being said, I agree with Johan--the patch would be
improved with a little better comment about what motivated
the submission.  So I'll wait for v2.

					-Alex

>>> ---
>>>  drivers/staging/greybus/core.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/greybus/core.c b/drivers/staging/greybus/core.c
>>> index dafa430..5d14a4e 100644
>>> --- a/drivers/staging/greybus/core.c
>>> +++ b/drivers/staging/greybus/core.c
>>> @@ -48,7 +48,7 @@ static bool greybus_match_one_id(struct gb_bundle *bundle,
>>>  static const struct greybus_bundle_id *
>>>  greybus_match_id(struct gb_bundle *bundle, const struct greybus_bundle_id *id)
>>>  {
>>> -	if (id == NULL)
>>> +	if (!id)
>>
>> It is pretty much personal preference and there is no good reason to accept this
>> patch really.
> 
> Checkpatch complains, so it's Official Kernel Style now.
> 
> The != NULL comparison is a double negative which makes it not less
> annoying than official kernel style.
> 
> regards,
> dan carpenter
> 
> _______________________________________________
> greybus-dev mailing list
> greybus-dev@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/greybus-dev
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-05 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-03 12:52 [PATCH] Staging:greybus Fix comparison to NULL Janani Sankara Babu
2018-06-05  5:32 ` [greybus-dev] " Viresh Kumar
2018-06-05  6:10   ` Johan Hovold
2018-06-05  9:00   ` Dan Carpenter
2018-06-05 12:36     ` Alex Elder

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).