linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gnss: core: added logging statement when kfifo_alloc fails
@ 2019-07-09 23:14 Keyur Patel
  2019-07-10  3:40 ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Keyur Patel @ 2019-07-09 23:14 UTC (permalink / raw)
  Cc: iamkeyur96, Johan Hovold, linux-kernel

Added missing logging statement when kfifo_alloc fails, to improve
debugging.

Signed-off-by: Keyur Patel <iamkeyur96@gmail.com>
---
 drivers/gnss/core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c
index e6f94501cb28..4377adfa25b4 100644
--- a/drivers/gnss/core.c
+++ b/drivers/gnss/core.c
@@ -256,6 +256,7 @@ struct gnss_device *gnss_allocate_device(struct device *parent)
 
 	ret = kfifo_alloc(&gdev->read_fifo, GNSS_READ_FIFO_SIZE, GFP_KERNEL);
 	if (ret)
+		pr_err("kfifo_alloc failed\n");
 		goto err_put_device;
 
 	gdev->write_buf = kzalloc(GNSS_WRITE_BUF_SIZE, GFP_KERNEL);
-- 
2.22.0


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

* [PATCH v2] gnss: core: added logging statement when kfifo_alloc fails
  2019-07-10  3:40 ` Joe Perches
@ 2019-07-09 23:59   ` Keyur Patel
  2019-07-11  8:26     ` Joe Perches
  0 siblings, 1 reply; 4+ messages in thread
From: Keyur Patel @ 2019-07-09 23:59 UTC (permalink / raw)
  Cc: iamkeyur96, Johan Hovold, linux-kernel

Added missing logging statement when kfifo_alloc fails, to improve
debugging.

Signed-off-by: Keyur Patel <iamkeyur96@gmail.com>
---
Changes in v2:
- fixed braces
---
 drivers/gnss/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c
index e6f94501cb28..1b7387ee643b 100644
--- a/drivers/gnss/core.c
+++ b/drivers/gnss/core.c
@@ -255,8 +255,10 @@ struct gnss_device *gnss_allocate_device(struct device *parent)
 	init_waitqueue_head(&gdev->read_queue);
 
 	ret = kfifo_alloc(&gdev->read_fifo, GNSS_READ_FIFO_SIZE, GFP_KERNEL);
-	if (ret)
+	if (ret) {
+		pr_err("kfifo_alloc failed\n");
 		goto err_put_device;
+	}
 
 	gdev->write_buf = kzalloc(GNSS_WRITE_BUF_SIZE, GFP_KERNEL);
 	if (!gdev->write_buf)
-- 
2.22.0


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

* Re: [PATCH] gnss: core: added logging statement when kfifo_alloc fails
  2019-07-09 23:14 [PATCH] gnss: core: added logging statement when kfifo_alloc fails Keyur Patel
@ 2019-07-10  3:40 ` Joe Perches
  2019-07-09 23:59   ` [PATCH v2] " Keyur Patel
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Perches @ 2019-07-10  3:40 UTC (permalink / raw)
  To: Keyur Patel; +Cc: Johan Hovold, linux-kernel

On Tue, 2019-07-09 at 19:14 -0400, Keyur Patel wrote:
> Added missing logging statement when kfifo_alloc fails, to improve
> debugging.\

Nack

> diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c
[]
> @@ -256,6 +256,7 @@ struct gnss_device *gnss_allocate_device(struct device *parent)
>  
>  	ret = kfifo_alloc(&gdev->read_fifo, GNSS_READ_FIFO_SIZE, GFP_KERNEL);
>  	if (ret)
> +		pr_err("kfifo_alloc failed\n");
>  		goto err_put_device;

c is not python.
This will not do what you might expect.
 
>  	gdev->write_buf = kzalloc(GNSS_WRITE_BUF_SIZE, GFP_KERNEL);


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

* Re: [PATCH v2] gnss: core: added logging statement when kfifo_alloc fails
  2019-07-09 23:59   ` [PATCH v2] " Keyur Patel
@ 2019-07-11  8:26     ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2019-07-11  8:26 UTC (permalink / raw)
  To: Keyur Patel; +Cc: Johan Hovold, linux-kernel

On Tue, 2019-07-09 at 19:59 -0400, Keyur Patel wrote:
> Added missing logging statement when kfifo_alloc fails, to improve
> debugging.
[]
> Changes in v2:
> - fixed braces
[]
> diff --git a/drivers/gnss/core.c b/drivers/gnss/core.c
[]
> @@ -255,8 +255,10 @@ struct gnss_device *gnss_allocate_device(struct device *parent)
>  	init_waitqueue_head(&gdev->read_queue);
>  
>  	ret = kfifo_alloc(&gdev->read_fifo, GNSS_READ_FIFO_SIZE, GFP_KERNEL);
> -	if (ret)
> +	if (ret) {
> +		pr_err("kfifo_alloc failed\n");
>  		goto err_put_device;
> +	}

This isn't really necessary as kfifo_alloc just
calls kmalloc_array and without the __GFP_NOWARN
flag, already does a dump_stack()



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

end of thread, other threads:[~2019-07-11  8:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09 23:14 [PATCH] gnss: core: added logging statement when kfifo_alloc fails Keyur Patel
2019-07-10  3:40 ` Joe Perches
2019-07-09 23:59   ` [PATCH v2] " Keyur Patel
2019-07-11  8:26     ` Joe Perches

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