Skip to contentSkip to conversation

MIPS: Alchemy: Delete an error message for a failed memory allocation in alchemy_pci_probe()

PATCH In review SF Markus Elfring 3 participants 9 messages May 24, 2017 – May 25, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: Alchemy: Delete an error message for a failed memory allocation in alchemy_pci_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 24 May 2017 18:32:21 +0200

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

This issue was detected by using the Coccinelle software.

---
 arch/mips/pci/pci-alchemy.c | 1 -
 1 file changed, 1 deletion(-)
arch/mips/pci/pci-alchemy.c +0 -1
index e99ca7702d8a..a58c3290bd4e 100644
@@ -377,7 +377,6 @@ static int alchemy_pci_probe(struct platform_device *pdev)
 
 	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
 	if (!ctx) {
-		dev_err(&pdev->dev, "no memory for pcictl context\n");
 		ret = -ENOMEM;
 		goto out;
 	}
Signature · 1 line
2.13.0
#1 lore raw
Quoted 26 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 24 May 2017 18:32:21 +0200

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

This issue was detected by using the Coccinelle software.

---
 arch/mips/pci/pci-alchemy.c | 1 -
 1 file changed, 1 deletion(-)
arch/mips/pci/pci-alchemy.c +0 -2
index e99ca7702d8a..a58c3290bd4e 100644
@@ -377,7 +377,6 @@ static int alchemy_pci_probe(struct platform_device *pdev)
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (!ctx) {
-               dev_err(&pdev->dev, "no memory for pcictl context\n");
                ret = -ENOMEM;
                goto out;
        }
--
Quoted 1 line

2.13.0

Why are you removing just this one dev_err()? What issue are you trying to address?

Manuel

#2 lore raw
Quoted 13 lines
Quoted 11 lines

+++ b/arch/mips/pci/pci-alchemy.c

arch/mips/pci/pci-alchemy.c +0 -2
@@ -377,7 +377,6 @@ static int alchemy_pci_probe(struct platform_device *pdev)
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (!ctx) {
-               dev_err(&pdev->dev, "no memory for pcictl context\n");
                ret = -ENOMEM;
                goto out;
        }
--

2.13.0

Why are you removing just this one dev_err()?

How do you think about to achieve a small code reduction also for this software module?

Quoted 1 line

What issue are you trying to address?

Do you find information from a Linux allocation failure report sufficient for such a function implementation?

Regards,
Markus

#3 lore raw
Quoted 13 lines · SF Markus Elfring
Quoted 13 lines
Quoted 11 lines

+++ b/arch/mips/pci/pci-alchemy.c

arch/mips/pci/pci-alchemy.c +0 -2
@@ -377,7 +377,6 @@ static int alchemy_pci_probe(struct platform_device *pdev)
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (!ctx) {
-               dev_err(&pdev->dev, "no memory for pcictl context\n");
                ret = -ENOMEM;
                goto out;
        }
--

2.13.0

Why are you removing just this one dev_err()?

Agreed. Why just this one error message when there are many in this function?

Quoted 7 lines

How do you think about to achieve a small code reduction also for this software module?

Quoted 1 line

What issue are you trying to address?

Do you find information from a Linux allocation failure report sufficient for such a function implementation?

Can you answer questions with statements instead of with questions?

thanks.

Signature · 1 line
~Randy
#4 lore raw
Quoted 1 line

Why just this one error message when there are many in this function?

A bigger software update depends on corresponding change acceptance and consensus for the evolution of affected error handling, doesn't it?

Regards,
Markus

#5 lore raw
In reply to SF Markus Elfring
Quoted 14 lines · SF Markus Elfring
Quoted 13 lines
Quoted 11 lines

+++ b/arch/mips/pci/pci-alchemy.c

arch/mips/pci/pci-alchemy.c +0 -2
@@ -377,7 +377,6 @@ static int alchemy_pci_probe(struct platform_device *pdev)
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (!ctx) {
-               dev_err(&pdev->dev, "no memory for pcictl context\n");
                ret = -ENOMEM;
                goto out;
        }
--

2.13.0

Why are you removing just this one dev_err()?

Quoted 1 line

How do you think about to achieve a small code reduction also for this software module?

Generally speaking, sure. But why remove just this one? Is it because it loosely follows a
pattern that was deemed removable in that slidedeck you linked to? (the "usb_submit_urb()" part)?

Quoted 4 lines
Quoted 1 line

What issue are you trying to address?

Do you find information from a Linux allocation failure report sufficient for such a function implementation?

Yes, I wrote that code, and in case this driver doesn't load, I'd like to know precisely where
initialization failed. I can happily spare a few bytes for that.

Manuel

#6 lore raw
Quoted 3 lines
Quoted 1 line

How do you think about to achieve a small code reduction also for this software module?

Generally speaking, sure.

Thanks for your interest in such a direction.

Quoted 2 lines

But why remove just this one? Is it because it loosely follows a pattern that was deemed removable in that slidedeck you linked to?

I derived another source code search approach from the implementation of the check “OOM_MESSAGE” in the script “checkpatch.pl” for the semantic patch language (Coccinelle software).
The involved search patterns are still evolving and the used lists (or regular expressions) for function names where it might make sense to reconsider the usage of special logging calls is therefore incomplete.

Quoted 1 line

(the "usb_submit_urb()" part)?

Would you like to extend the function selection for further considerations?

Quoted 6 lines
Quoted 2 lines

Do you find information from a Linux allocation failure report sufficient for such a function implementation?

Yes, I wrote that code, and in case this driver doesn't load, I'd like to know precisely where initialization failed.
I can happily spare a few bytes for that.

Does this kind of answer contain a bit of contradiction?

* Why do you seem to insist on another message if information from a Linux allocation failure report would be sufficient already also for this software module?

* Do you want that it can become easier to map a position in a backtrace to a place in your source code?

Regards,
Markus

#7 lore raw
Quoted 30 lines · SF Markus Elfring
Quoted 3 lines
Quoted 1 line

How do you think about to achieve a small code reduction also for this software module?

Generally speaking, sure.

Thanks for your interest in such a direction.

Quoted 2 lines

But why remove just this one? Is it because it loosely follows a pattern that was deemed removable in that slidedeck you linked to?

I derived another source code search approach from the implementation of the check “OOM_MESSAGE” in the script “checkpatch.pl” for the semantic patch language (Coccinelle software).
The involved search patterns are still evolving and the used lists (or regular expressions) for function names where it might make sense to reconsider the usage of special logging calls is therefore incomplete.

Quoted 1 line

(the "usb_submit_urb()" part)?

Would you like to extend the function selection for further considerations?

Quoted 6 lines
Quoted 2 lines

Do you find information from a Linux allocation failure report sufficient for such a function implementation?

Yes, I wrote that code, and in case this driver doesn't load, I'd like to know precisely where initialization failed.
I can happily spare a few bytes for that.

Quoted 8 lines

Does this kind of answer contain a bit of contradiction?

* Why do you seem to insist on another message if information from a Linux allocation failure report would be sufficient already also for this software module?

* Do you want that it can become easier to map a position in a backtrace to a place in your source code?

Does kmalloc() nowadays print a message which invocation (source line) failed? If so I won't be standing in your way, but if not, you need to come up with something for convincing than answering questions with more questions.

Manuel

#8 lore raw
Quoted 10 lines
Quoted 6 lines

* Why do you seem to insist on another message if information from a Linux allocation failure report would be sufficient already also for this software module?

* Do you want that it can become easier to map a position in a backtrace to a place in your source code?

Does kmalloc() nowadays print a message which invocation (source line) failed? If so I won't be standing in your way, but if not, you need to come up with something for convincing than answering questions with more questions.

I suggest also to improve the corresponding documentation for the affected programming interfaces in significant ways.
How are the chances for the desired clarification of relevant implementation details?

Regards,
Markus