Skip to contentSkip to conversation

trivial: Changed the printk loglevel when not able to allocate memory

PATCH In review anish 3 participants 6 messages May 17, 2011 – May 18, 2011 2 messages not in the archive Framebuffer layer

lore
Share & tools
lore

anish

author
#0 lore raw

PATCH 2/2 trivial: Changed the printk loglevel when not able to allocate memory

When not able to allocate memory we were using KERN_INFO as log level in printk so changed to KERN_ERR

---
 drivers/video/amba-clcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/amba-clcd.c +1 -1
index cb7ec86..e87d98b 100644
@@ -551,7 +551,7 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)
 
 	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
 	if (!fb) {
-		printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n");
+		printk(KERN_ERR "CLCD: could not allocate new clcd_fb struct\n");
 		ret = -ENOMEM;
 		goto free_region;
 	}
Signature · 1 line
1.7.0.4
Quoted 1 line

From 19bbb666a6067a6ba280e2cb984c924bcaf06f52 Mon Sep 17 00:00:00 2001

From: anish kumar <[email protected]>
Date: Tue, 17 May 2011 22:50:59 +0530
Subject: [PATCH 2/2] Changed the printk loglevel when not able to allocate memory
When not able to allocate memory we were using KERN_INFO so just changed to KERN_ERR

---
 drivers/video/amba-clcd.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/amba-clcd.c +1 -1
index cb7ec86..e87d98b 100644
@@ -551,7 +551,7 @@ static int clcdfb_probe(struct amba_device *dev, const struct amba_id *id)
 
 	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
 	if (!fb) {
-		printk(KERN_INFO "CLCD: could not allocate new clcd_fb struct\n");
+		printk(KERN_ERR "CLCD: could not allocate new clcd_fb struct\n");
 		ret = -ENOMEM;
 		goto free_region;
 	}
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 3 lines · anish

When not able to allocate memory we were using KERN_INFO as log level in printk so changed to KERN_ERR
 Signed-off-by: anish kumar<[email protected]>

Maybe KERN_WARN?

Signature · 1 line
Catalin

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 7 lines · anish singh

On Tue, May 17, 2011 at 11:13 PM, Catalin Marinas <[email protected]> wrote:
On 17 May 2011 18:29, anish <[email protected]> wrote:
> When not able to allocate memory we were using KERN_INFO as > log level in printk so changed to KERN_ERR
> Signed-off-by: anish kumar<[email protected]>

Quoted 8 lines

Maybe KERN_WARN?
Then shouldn't we change below case also?
467 ret = amba_request_regions(dev, NULL);
468 if (ret) {
469 printk(KERN_ERR "CLCD: unable to reserve regs region\n");
470 goto out;

If yes,then i will resend the patch for this also.

I think the register reserving is less likely to fail because of memory allocations but more because of overlapping regions, in which case it could be a programming error.

Allocating a big framebuffer is likely to fail in some memory constraint systems but I don't consider this a kernel error. That's why I suggested warning.

Signature · 1 line
Catalin

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 24 lines · anish singh

On Wed, May 18, 2011 at 3:45 PM, Catalin Marinas <[email protected]> wrote:

On Wed, 2011-05-18 at 04:19 +0100, anish singh wrote:
> On Tue, May 17, 2011 at 11:13 PM, Catalin Marinas <[email protected]> wrote:
> On 17 May 2011 18:29, anish <[email protected]> wrote:
> > When not able to allocate memory we were using KERN_INFO as
> > log level in printk so changed to KERN_ERR
> > Signed-off-by: anish kumar<[email protected]>
>
>
> Maybe KERN_WARN?
> Then shouldn't we change below case also?
> 467 ret = amba_request_regions(dev, NULL);
> 468 if (ret) {
> 469 printk(KERN_ERR "CLCD: unable to reserve regs region\n");
> 470 goto out;
>
> If yes,then i will resend the patch for this also.

I think the register reserving is less likely to fail because of memory allocations but more because of overlapping regions, in which case it could be a programming error.

Quoted 5 lines

Allocating a big framebuffer is likely to fail in some memory constraint systems but I don't consider this a kernel error. That's why I suggested warning.

Got it.So should i change both as KERN_WARN and resend?

No, just the one KERN_INFO one. Anyway, Russell King is the maintainer of this driver so it's up to him to ack the patch (and don't forget to cc him).

Signature · 1 line
Catalin
#7 lore raw
Quoted 5 lines · Russell King - ARM Linux
Quoted 1 line · anish singh

Got it.So should i change both as KERN_WARN and resend?

Much better would be to change it to pr_warn() or even dev_warn(&dev->dev, ...).

Actually, make that pr_err() or dev_err(). Both printks in clcdfb_probe() are errors and so should be reported at error severity - they cause things to stop working and so they're not just a warning.