All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry()
@ 2017-08-27 19:25 ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-08-27 19:25 UTC (permalink / raw)
  To: netdev, Evgeniy Polyakov; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 27 Aug 2017 21:18:37 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/connector/cn_queue.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index 1f8bf054d11c..e4f31d679f02 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -40,10 +40,8 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
 	struct cn_callback_entry *cbq;
 
 	cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
-	if (!cbq) {
-		pr_err("Failed to create new callback queue.\n");
+	if (!cbq)
 		return NULL;
-	}
 
 	atomic_set(&cbq->refcnt, 1);
 
-- 
2.14.1

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

* [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback
@ 2017-08-27 19:25 ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-08-27 19:25 UTC (permalink / raw)
  To: netdev, Evgeniy Polyakov; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 27 Aug 2017 21:18:37 +0200

Omit an extra message for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/connector/cn_queue.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
index 1f8bf054d11c..e4f31d679f02 100644
--- a/drivers/connector/cn_queue.c
+++ b/drivers/connector/cn_queue.c
@@ -40,10 +40,8 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
 	struct cn_callback_entry *cbq;
 
 	cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
-	if (!cbq) {
-		pr_err("Failed to create new callback queue.\n");
+	if (!cbq)
 		return NULL;
-	}
 
 	atomic_set(&cbq->refcnt, 1);
 
-- 
2.14.1


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

* Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry()
  2017-08-27 19:25 ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback SF Markus Elfring
@ 2017-08-27 23:16   ` Waskiewicz Jr, Peter
  -1 siblings, 0 replies; 12+ messages in thread
From: Waskiewicz Jr, Peter @ 2017-08-27 23:16 UTC (permalink / raw)
  To: SF Markus Elfring, netdev, Evgeniy Polyakov; +Cc: LKML, kernel-janitors

On 8/27/17 3:26 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 27 Aug 2017 21:18:37 +0200
> 
> Omit an extra message for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.

Did coccinelle trip on the message or the fact you weren't returning NULL?

> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>   drivers/connector/cn_queue.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
> index 1f8bf054d11c..e4f31d679f02 100644
> --- a/drivers/connector/cn_queue.c
> +++ b/drivers/connector/cn_queue.c
> @@ -40,10 +40,8 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
>   	struct cn_callback_entry *cbq;
>   
>   	cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
> -	if (!cbq) {
> -		pr_err("Failed to create new callback queue.\n");
> +	if (!cbq)
>   		return NULL;
> -	}

Wny not:

	if (!cbq) {
		pr_err("Failed to create new callback queue.\n");
+		return NULL;
	}

>   
>   	atomic_set(&cbq->refcnt, 1);
>   
> 

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

* Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call
@ 2017-08-27 23:16   ` Waskiewicz Jr, Peter
  0 siblings, 0 replies; 12+ messages in thread
From: Waskiewicz Jr, Peter @ 2017-08-27 23:16 UTC (permalink / raw)
  To: SF Markus Elfring, netdev, Evgeniy Polyakov; +Cc: LKML, kernel-janitors

On 8/27/17 3:26 PM, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 27 Aug 2017 21:18:37 +0200
> 
> Omit an extra message for a memory allocation failure in this function.
> 
> This issue was detected by using the Coccinelle software.

Did coccinelle trip on the message or the fact you weren't returning NULL?

> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>   drivers/connector/cn_queue.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
> index 1f8bf054d11c..e4f31d679f02 100644
> --- a/drivers/connector/cn_queue.c
> +++ b/drivers/connector/cn_queue.c
> @@ -40,10 +40,8 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
>   	struct cn_callback_entry *cbq;
>   
>   	cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
> -	if (!cbq) {
> -		pr_err("Failed to create new callback queue.\n");
> +	if (!cbq)
>   		return NULL;
> -	}

Wny not:

	if (!cbq) {
		pr_err("Failed to create new callback queue.\n");
+		return NULL;
	}

>   
>   	atomic_set(&cbq->refcnt, 1);
>   
> 


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

* Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry()
  2017-08-27 23:16   ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call Waskiewicz Jr, Peter
@ 2017-08-28  6:05     ` Dan Carpenter
  -1 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-08-28  6:05 UTC (permalink / raw)
  To: Waskiewicz Jr, Peter
  Cc: SF Markus Elfring, netdev, Evgeniy Polyakov, LKML, kernel-janitors

On Sun, Aug 27, 2017 at 11:16:06PM +0000, Waskiewicz Jr, Peter wrote:
> On 8/27/17 3:26 PM, SF Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Sun, 27 Aug 2017 21:18:37 +0200
> > 
> > Omit an extra message for a memory allocation failure in this function.
> > 
> > This issue was detected by using the Coccinelle software.
> 
> Did coccinelle trip on the message or the fact you weren't returning NULL?
> 

You've misread the patch somehow.  The existing code has a NULL return
and it's preserved in Markus's patch.  This sort of patch is to fix a
checkpatch.pl warning.  The error message from this kzalloc() isn't going
to get printed because it's a small allocation and small allocations
always succeed in current kernels.  But probably the main reason
checkpatch complains is that kmalloc() already prints a stack trace and
a bunch of other information so the printk doesn't add anyting.
Removing it saves a little memory.

I'm mostly a fan of running checkpatch on new patches or staging and not
on old code...

regards,
dan carpenter

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

* Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call
@ 2017-08-28  6:05     ` Dan Carpenter
  0 siblings, 0 replies; 12+ messages in thread
From: Dan Carpenter @ 2017-08-28  6:05 UTC (permalink / raw)
  To: Waskiewicz Jr, Peter
  Cc: SF Markus Elfring, netdev, Evgeniy Polyakov, LKML, kernel-janitors

On Sun, Aug 27, 2017 at 11:16:06PM +0000, Waskiewicz Jr, Peter wrote:
> On 8/27/17 3:26 PM, SF Markus Elfring wrote:
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Sun, 27 Aug 2017 21:18:37 +0200
> > 
> > Omit an extra message for a memory allocation failure in this function.
> > 
> > This issue was detected by using the Coccinelle software.
> 
> Did coccinelle trip on the message or the fact you weren't returning NULL?
> 

You've misread the patch somehow.  The existing code has a NULL return
and it's preserved in Markus's patch.  This sort of patch is to fix a
checkpatch.pl warning.  The error message from this kzalloc() isn't going
to get printed because it's a small allocation and small allocations
always succeed in current kernels.  But probably the main reason
checkpatch complains is that kmalloc() already prints a stack trace and
a bunch of other information so the printk doesn't add anyting.
Removing it saves a little memory.

I'm mostly a fan of running checkpatch on new patches or staging and not
on old code...

regards,
dan carpenter


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

* Re: connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry()
  2017-08-27 23:16   ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call Waskiewicz Jr, Peter
@ 2017-08-28  7:09     ` SF Markus Elfring
  -1 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-08-28  7:09 UTC (permalink / raw)
  To: Peter Waskiewicz Jr, netdev; +Cc: Evgeniy Polyakov, LKML, kernel-janitors

> Did coccinelle trip on the message

I suggest to reconsider this implementation detail with the combination
of a function call like “kzalloc”.
A script for the semantic patch language can point various update candidates
out according to a source code search pattern which is similar to “OOM_MESSAGE”
in the script “checkpatch.pl”.


> or the fact you weren't returning NULL?

How does this concern fit to my update suggestion?

Regards,
Markus

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

* Re: connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_ent
@ 2017-08-28  7:09     ` SF Markus Elfring
  0 siblings, 0 replies; 12+ messages in thread
From: SF Markus Elfring @ 2017-08-28  7:09 UTC (permalink / raw)
  To: Peter Waskiewicz Jr, netdev; +Cc: Evgeniy Polyakov, LKML, kernel-janitors

> Did coccinelle trip on the message

I suggest to reconsider this implementation detail with the combination
of a function call like “kzalloc”.
A script for the semantic patch language can point various update candidates
out according to a source code search pattern which is similar to “OOM_MESSAGE”
in the script “checkpatch.pl”.


> or the fact you weren't returning NULL?

How does this concern fit to my update suggestion?

Regards,
Markus

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

* Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry()
  2017-08-28  6:05     ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call Dan Carpenter
@ 2017-08-28 14:05       ` Waskiewicz Jr, Peter
  -1 siblings, 0 replies; 12+ messages in thread
From: Waskiewicz Jr, Peter @ 2017-08-28 14:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: SF Markus Elfring, netdev, Evgeniy Polyakov, LKML, kernel-janitors

On 8/28/17 2:06 AM, Dan Carpenter wrote:
> On Sun, Aug 27, 2017 at 11:16:06PM +0000, Waskiewicz Jr, Peter wrote:
>> On 8/27/17 3:26 PM, SF Markus Elfring wrote:
>>> From: Markus Elfring <elfring@users.sourceforge.net>
>>> Date: Sun, 27 Aug 2017 21:18:37 +0200
>>>
>>> Omit an extra message for a memory allocation failure in this function.
>>>
>>> This issue was detected by using the Coccinelle software.
>>
>> Did coccinelle trip on the message or the fact you weren't returning NULL?
>>
> 
> You've misread the patch somehow.  The existing code has a NULL return
> and it's preserved in Markus's patch.  This sort of patch is to fix a
> checkpatch.pl warning.  The error message from this kzalloc() isn't going
> to get printed because it's a small allocation and small allocations
> always succeed in current kernels.  But probably the main reason
> checkpatch complains is that kmalloc() already prints a stack trace and
> a bunch of other information so the printk doesn't add anyting.
> Removing it saves a little memory.
> 
> I'm mostly a fan of running checkpatch on new patches or staging and not
> on old code...

And this is what I get for reading the patch with a crappy 
mailer...thanks Doubtlook.

Sorry for the noise.

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

* Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call
@ 2017-08-28 14:05       ` Waskiewicz Jr, Peter
  0 siblings, 0 replies; 12+ messages in thread
From: Waskiewicz Jr, Peter @ 2017-08-28 14:05 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: SF Markus Elfring, netdev, Evgeniy Polyakov, LKML, kernel-janitors

On 8/28/17 2:06 AM, Dan Carpenter wrote:
> On Sun, Aug 27, 2017 at 11:16:06PM +0000, Waskiewicz Jr, Peter wrote:
>> On 8/27/17 3:26 PM, SF Markus Elfring wrote:
>>> From: Markus Elfring <elfring@users.sourceforge.net>
>>> Date: Sun, 27 Aug 2017 21:18:37 +0200
>>>
>>> Omit an extra message for a memory allocation failure in this function.
>>>
>>> This issue was detected by using the Coccinelle software.
>>
>> Did coccinelle trip on the message or the fact you weren't returning NULL?
>>
> 
> You've misread the patch somehow.  The existing code has a NULL return
> and it's preserved in Markus's patch.  This sort of patch is to fix a
> checkpatch.pl warning.  The error message from this kzalloc() isn't going
> to get printed because it's a small allocation and small allocations
> always succeed in current kernels.  But probably the main reason
> checkpatch complains is that kmalloc() already prints a stack trace and
> a bunch of other information so the printk doesn't add anyting.
> Removing it saves a little memory.
> 
> I'm mostly a fan of running checkpatch on new patches or staging and not
> on old code...

And this is what I get for reading the patch with a crappy 
mailer...thanks Doubtlook.

Sorry for the noise.

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

* Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry()
  2017-08-27 19:25 ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback SF Markus Elfring
@ 2017-09-05 13:10   ` Evgeniy Polyakov
  -1 siblings, 0 replies; 12+ messages in thread
From: Evgeniy Polyakov @ 2017-09-05 13:10 UTC (permalink / raw)
  To: SF Markus Elfring, netdev; +Cc: LKML, kernel-janitors

Hi everyone

27.08.2017, 22:25, "SF Markus Elfring" <elfring@users.sourceforge.net>:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 27 Aug 2017 21:18:37 +0200
>
> Omit an extra message for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Looks good to me, thanks Markus.
There is virtually zero useful information in this print if we are in the situation, when kernel can not allocate
a few bytes to run connector queue.

Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

kernel-janitors@ please queue this patch up

> ---
>  drivers/connector/cn_queue.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
> index 1f8bf054d11c..e4f31d679f02 100644
> --- a/drivers/connector/cn_queue.c
> +++ b/drivers/connector/cn_queue.c
> @@ -40,10 +40,8 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
>          struct cn_callback_entry *cbq;
>
>          cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
> - if (!cbq) {
> - pr_err("Failed to create new callback queue.\n");
> + if (!cbq)
>                  return NULL;
> - }
>
>          atomic_set(&cbq->refcnt, 1);
>
> --
> 2.14.1

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

* Re: [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call
@ 2017-09-05 13:10   ` Evgeniy Polyakov
  0 siblings, 0 replies; 12+ messages in thread
From: Evgeniy Polyakov @ 2017-09-05 13:10 UTC (permalink / raw)
  To: SF Markus Elfring, netdev; +Cc: LKML, kernel-janitors

Hi everyone

27.08.2017, 22:25, "SF Markus Elfring" <elfring@users.sourceforge.net>:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 27 Aug 2017 21:18:37 +0200
>
> Omit an extra message for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Looks good to me, thanks Markus.
There is virtually zero useful information in this print if we are in the situation, when kernel can not allocate
a few bytes to run connector queue.

Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

kernel-janitors@ please queue this patch up

> ---
>  drivers/connector/cn_queue.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/connector/cn_queue.c b/drivers/connector/cn_queue.c
> index 1f8bf054d11c..e4f31d679f02 100644
> --- a/drivers/connector/cn_queue.c
> +++ b/drivers/connector/cn_queue.c
> @@ -40,10 +40,8 @@ cn_queue_alloc_callback_entry(struct cn_queue_dev *dev, const char *name,
>          struct cn_callback_entry *cbq;
>
>          cbq = kzalloc(sizeof(*cbq), GFP_KERNEL);
> - if (!cbq) {
> - pr_err("Failed to create new callback queue.\n");
> + if (!cbq)
>                  return NULL;
> - }
>
>          atomic_set(&cbq->refcnt, 1);
>
> --
> 2.14.1

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

end of thread, other threads:[~2017-09-05 13:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-27 19:25 [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry() SF Markus Elfring
2017-08-27 19:25 ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback SF Markus Elfring
2017-08-27 23:16 ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry() Waskiewicz Jr, Peter
2017-08-27 23:16   ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call Waskiewicz Jr, Peter
2017-08-28  6:05   ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry() Dan Carpenter
2017-08-28  6:05     ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call Dan Carpenter
2017-08-28 14:05     ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry() Waskiewicz Jr, Peter
2017-08-28 14:05       ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call Waskiewicz Jr, Peter
2017-08-28  7:09   ` connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry() SF Markus Elfring
2017-08-28  7:09     ` connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_ent SF Markus Elfring
2017-09-05 13:10 ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_callback_entry() Evgeniy Polyakov
2017-09-05 13:10   ` [PATCH] connector: Delete an error message for a failed memory allocation in cn_queue_alloc_call Evgeniy Polyakov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.