diff mbox

platform/x86: dell-smo8800: Possible unnecessary 'out of memory' message

Message ID 20171213082354.23273-1-dhaval.shah@softnautics.com (mailing list archive)
State Rejected, archived
Delegated to: Andy Shevchenko
Headers show

Commit Message

Dhaval Shah Dec. 13, 2017, 8:23 a.m. UTC
Removed Possible unnecessary 'out of memory' message checkpatch warnings.
Issue found by checkpatch.

Signed-off-by: Dhaval Shah <dhaval.shah@softnautics.com>
---
 drivers/platform/x86/dell-smo8800.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Pali Rohár Dec. 13, 2017, 8:30 a.m. UTC | #1
On Wednesday 13 December 2017 13:53:54 Dhaval Shah wrote:
> Removed Possible unnecessary 'out of memory' message checkpatch warnings.
> Issue found by checkpatch.
> 
> Signed-off-by: Dhaval Shah <dhaval.shah@softnautics.com>
> ---
>  drivers/platform/x86/dell-smo8800.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/dell-smo8800.c b/drivers/platform/x86/dell-smo8800.c
> index 1d87237bc731..9590d5e7c5ca 100644
> --- a/drivers/platform/x86/dell-smo8800.c
> +++ b/drivers/platform/x86/dell-smo8800.c
> @@ -150,10 +150,8 @@ static int smo8800_add(struct acpi_device *device)
>  	struct smo8800_device *smo8800;
>  
>  	smo8800 = devm_kzalloc(&device->dev, sizeof(*smo8800), GFP_KERNEL);
> -	if (!smo8800) {
> -		dev_err(&device->dev, "failed to allocate device data\n");

Hi! Any particular reason for removing error message?

> +	if (!smo8800)
>  		return -ENOMEM;
> -	}
>  
>  	smo8800->dev = &device->dev;
>  	smo8800->miscdev.minor = MISC_DYNAMIC_MINOR;
Dhaval Shah Dec. 13, 2017, 9:40 a.m. UTC | #2
Hi Pali Rohar,

Thanks for the review.
Andy Shevchenko Dec. 14, 2017, 6:02 p.m. UTC | #3
On Wed, Dec 13, 2017 at 10:30 AM, Pali Rohár <pali.rohar@gmail.com> wrote:
> On Wednesday 13 December 2017 13:53:54 Dhaval Shah wrote:
>> Removed Possible unnecessary 'out of memory' message checkpatch warnings.
>> Issue found by checkpatch.

>> -             dev_err(&device->dev, "failed to allocate device data\n");
>
> Hi! Any particular reason for removing error message?

If you look into drivers/base/dd.c (real_probe() function IIRC) it
issues a warning when probe fails with error code.
So, basically all error messages in ->probe() are redundant (except
maybe those that prints more than error message itself).
diff mbox

Patch

diff --git a/drivers/platform/x86/dell-smo8800.c b/drivers/platform/x86/dell-smo8800.c
index 1d87237bc731..9590d5e7c5ca 100644
--- a/drivers/platform/x86/dell-smo8800.c
+++ b/drivers/platform/x86/dell-smo8800.c
@@ -150,10 +150,8 @@  static int smo8800_add(struct acpi_device *device)
 	struct smo8800_device *smo8800;
 
 	smo8800 = devm_kzalloc(&device->dev, sizeof(*smo8800), GFP_KERNEL);
-	if (!smo8800) {
-		dev_err(&device->dev, "failed to allocate device data\n");
+	if (!smo8800)
 		return -ENOMEM;
-	}
 
 	smo8800->dev = &device->dev;
 	smo8800->miscdev.minor = MISC_DYNAMIC_MINOR;