Skip to contentSkip to conversation

gnss: core: added logging statement when kfifo_alloc fails

PATCH Superseded Keyur Patel 2 participants 4 messages Jul 10, 2019 – Jul 11, 2019 Gnss

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gnss: core: added logging statement when kfifo_alloc fails

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

---
 drivers/gnss/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gnss/core.c +1 -0
index e6f94501cb28..4377adfa25b4 100644
@@ -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);
Signature · 1 line
2.22.0
#1 lore raw
Quoted 2 lines · Keyur Patel

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

Nack

drivers/gnss/core.c

Quoted 1 line
drivers/gnss/core.c +0 -0

[]

drivers/gnss/core.c struct gnss_device *gnss_allocate_device(struct device *parent) · line 260

Quoted 6 lines
drivers/gnss/core.c +1 -0
@@ -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.

Quoted 1 line
drivers/gnss/core.c +0 -0
 	gdev->write_buf = kzalloc(GNSS_WRITE_BUF_SIZE, GFP_KERNEL);
#2 lore raw

PATCH v2 1/1 gnss: core: added logging statement when kfifo_alloc fails

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

---
Changes in v2:
- fixed braces

---
 drivers/gnss/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gnss/core.c +3 -1
index e6f94501cb28..1b7387ee643b 100644
@@ -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)
Signature · 1 line
2.22.0
#3 lore raw
Quoted 2 lines · Keyur Patel

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

[]

Quoted 2 lines

Changes in v2:
- fixed braces

[]

drivers/gnss/core.c

Quoted 1 line
drivers/gnss/core.c +0 -0

[]

drivers/gnss/core.c struct gnss_device *gnss_allocate_device(struct device *parent) · line 261

Quoted 9 lines
drivers/gnss/core.c +3 -1
@@ -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()