linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] iio: frequency: Fix checkpatch warnings
@ 2014-12-16  9:11 Roberta Dobrescu
  2014-12-16  9:11 ` [PATCH 1/3] iio: frequency: Remove 'out of memory' message Roberta Dobrescu
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Roberta Dobrescu @ 2014-12-16  9:11 UTC (permalink / raw)
  To: jic23, linux-iio
  Cc: octavian.purdila, daniel.baluta, lars, Michael.Hennerich,
	knaack.h, pmeerw, Roberta Dobrescu

This patchset fixes warnings detected using checkpatch.pl,
such as: useless 'out of memory' message, unnecessary braces around single
statement block, inadequate usage of msleep function.


Roberta Dobrescu (3):
  iio: frequency: Remove 'out of memory' message
  iio: frequency: Remove unnecessary braces around single statement block
  iio: frequency: Use usleep_range instead of msleep

 drivers/iio/frequency/ad9523.c  | 2 +-
 drivers/iio/frequency/adf4350.c | 7 ++-----
 2 files changed, 3 insertions(+), 6 deletions(-)

-- 
1.9.1


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

* [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-16  9:11 [PATCH 0/3] iio: frequency: Fix checkpatch warnings Roberta Dobrescu
@ 2014-12-16  9:11 ` Roberta Dobrescu
  2014-12-16 11:22   ` Daniel Baluta
                     ` (3 more replies)
  2014-12-16  9:11 ` [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block Roberta Dobrescu
  2014-12-16  9:11 ` [PATCH 3/3] iio: frequency: Use usleep_range instead of msleep Roberta Dobrescu
  2 siblings, 4 replies; 17+ messages in thread
From: Roberta Dobrescu @ 2014-12-16  9:11 UTC (permalink / raw)
  To: jic23, linux-iio
  Cc: octavian.purdila, daniel.baluta, lars, Michael.Hennerich,
	knaack.h, pmeerw, Roberta Dobrescu

This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
---
 drivers/iio/frequency/adf4350.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index 63a25d9..2b301eb 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
 	int ret;
 
 	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
-	if (!pdata) {
-		dev_err(dev, "could not allocate memory for platform data\n");
+	if (!pdata)
 		return NULL;
-	}
 
 	strncpy(&pdata->name[0], np->name, SPI_NAME_SIZE - 1);
 
-- 
1.9.1

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

* [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block
  2014-12-16  9:11 [PATCH 0/3] iio: frequency: Fix checkpatch warnings Roberta Dobrescu
  2014-12-16  9:11 ` [PATCH 1/3] iio: frequency: Remove 'out of memory' message Roberta Dobrescu
@ 2014-12-16  9:11 ` Roberta Dobrescu
  2014-12-16 11:23   ` Daniel Baluta
  2014-12-18 16:13   ` Lars-Peter Clausen
  2014-12-16  9:11 ` [PATCH 3/3] iio: frequency: Use usleep_range instead of msleep Roberta Dobrescu
  2 siblings, 2 replies; 17+ messages in thread
From: Roberta Dobrescu @ 2014-12-16  9:11 UTC (permalink / raw)
  To: jic23, linux-iio
  Cc: octavian.purdila, daniel.baluta, lars, Michael.Hennerich,
	knaack.h, pmeerw, Roberta Dobrescu

This patch fixes the following checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
---
 drivers/iio/frequency/adf4350.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index 2b301eb..10a0dfc 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -611,9 +611,8 @@ static int adf4350_remove(struct spi_device *spi)
 	if (st->clk)
 		clk_disable_unprepare(st->clk);
 
-	if (!IS_ERR(reg)) {
+	if (!IS_ERR(reg))
 		regulator_disable(reg);
-	}
 
 	return 0;
 }
-- 
1.9.1

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

* [PATCH 3/3] iio: frequency: Use usleep_range instead of msleep
  2014-12-16  9:11 [PATCH 0/3] iio: frequency: Fix checkpatch warnings Roberta Dobrescu
  2014-12-16  9:11 ` [PATCH 1/3] iio: frequency: Remove 'out of memory' message Roberta Dobrescu
  2014-12-16  9:11 ` [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block Roberta Dobrescu
@ 2014-12-16  9:11 ` Roberta Dobrescu
  2014-12-18 16:09   ` Lars-Peter Clausen
  2 siblings, 1 reply; 17+ messages in thread
From: Roberta Dobrescu @ 2014-12-16  9:11 UTC (permalink / raw)
  To: jic23, linux-iio
  Cc: octavian.purdila, daniel.baluta, lars, Michael.Hennerich,
	knaack.h, pmeerw, Roberta Dobrescu

This patch fixes the following checkpatch.pl warning:
WARNING: msleep < 20ms can sleep for up to 20ms

Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
---
 drivers/iio/frequency/ad9523.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index 7c5245d..2e41ca5 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -445,7 +445,7 @@ static int ad9523_store_eeprom(struct iio_dev *indio_dev)
 
 	tmp = 4;
 	do {
-		msleep(16);
+		usleep_range(16000, 17000);
 		ret = ad9523_read(indio_dev,
 				  AD9523_EEPROM_DATA_XFER_STATUS);
 		if (ret < 0)
-- 
1.9.1

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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-16  9:11 ` [PATCH 1/3] iio: frequency: Remove 'out of memory' message Roberta Dobrescu
@ 2014-12-16 11:22   ` Daniel Baluta
  2014-12-18 16:14   ` Lars-Peter Clausen
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 17+ messages in thread
From: Daniel Baluta @ 2014-12-16 11:22 UTC (permalink / raw)
  To: Roberta Dobrescu
  Cc: Jonathan Cameron, linux-iio@vger.kernel.org,
	octavian.purdila@intel.com, Daniel Baluta, Lars-Peter Clausen,
	Michael.Hennerich, Hartmut Knaack, Peter Meerwald

On Tue, Dec 16, 2014 at 11:11 AM, Roberta Dobrescu
<roberta.dobrescu@gmail.com> wrote:
> This patch fixes the following checkpatch.pl warning:
> WARNING: Possible unnecessary 'out of memory' message
>
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>

Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>

> ---
>  drivers/iio/frequency/adf4350.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
> index 63a25d9..2b301eb 100644
> --- a/drivers/iio/frequency/adf4350.c
> +++ b/drivers/iio/frequency/adf4350.c
> @@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>         int ret;
>
>         pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -       if (!pdata) {
> -               dev_err(dev, "could not allocate memory for platform data\n");
> +       if (!pdata)
>                 return NULL;
> -       }
>
>         strncpy(&pdata->name[0], np->name, SPI_NAME_SIZE - 1);
>
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block
  2014-12-16  9:11 ` [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block Roberta Dobrescu
@ 2014-12-16 11:23   ` Daniel Baluta
  2014-12-18 16:13   ` Lars-Peter Clausen
  1 sibling, 0 replies; 17+ messages in thread
From: Daniel Baluta @ 2014-12-16 11:23 UTC (permalink / raw)
  To: Roberta Dobrescu
  Cc: Jonathan Cameron, linux-iio@vger.kernel.org,
	octavian.purdila@intel.com, Daniel Baluta, Lars-Peter Clausen,
	Michael.Hennerich, Hartmut Knaack, Peter Meerwald

On Tue, Dec 16, 2014 at 11:11 AM, Roberta Dobrescu
<roberta.dobrescu@gmail.com> wrote:
> This patch fixes the following checkpatch.pl warning:
> WARNING: braces {} are not necessary for single statement blocks
>
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>

Reviewed-by: Daniel Baluta <daniel.baluta@intel.com>

> ---
>  drivers/iio/frequency/adf4350.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
> index 2b301eb..10a0dfc 100644
> --- a/drivers/iio/frequency/adf4350.c
> +++ b/drivers/iio/frequency/adf4350.c
> @@ -611,9 +611,8 @@ static int adf4350_remove(struct spi_device *spi)
>         if (st->clk)
>                 clk_disable_unprepare(st->clk);
>
> -       if (!IS_ERR(reg)) {
> +       if (!IS_ERR(reg))
>                 regulator_disable(reg);
> -       }
>
>         return 0;
>  }
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH 3/3] iio: frequency: Use usleep_range instead of msleep
  2014-12-16  9:11 ` [PATCH 3/3] iio: frequency: Use usleep_range instead of msleep Roberta Dobrescu
@ 2014-12-18 16:09   ` Lars-Peter Clausen
  0 siblings, 0 replies; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-12-18 16:09 UTC (permalink / raw)
  To: Roberta Dobrescu, jic23, linux-iio
  Cc: octavian.purdila, daniel.baluta, Michael.Hennerich, knaack.h,
	pmeerw

On 12/16/2014 10:11 AM, Roberta Dobrescu wrote:
> This patch fixes the following checkpatch.pl warning:
> WARNING: msleep < 20ms can sleep for up to 20ms
>
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
> ---
>   drivers/iio/frequency/ad9523.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
> index 7c5245d..2e41ca5 100644
> --- a/drivers/iio/frequency/ad9523.c
> +++ b/drivers/iio/frequency/ad9523.c
> @@ -445,7 +445,7 @@ static int ad9523_store_eeprom(struct iio_dev *indio_dev)
>
>   	tmp = 4;
>   	do {
> -		msleep(16);
> +		usleep_range(16000, 17000);

I don't think this is exactly timing critical, things will work fine if this 
sleeps a bit longer. If you want to silence the warning for the sake of 
silencing the warning, maybe just replace it with a msleep(20).

>   		ret = ad9523_read(indio_dev,
>   				  AD9523_EEPROM_DATA_XFER_STATUS);
>   		if (ret < 0)
>

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

* Re: [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block
  2014-12-16  9:11 ` [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block Roberta Dobrescu
  2014-12-16 11:23   ` Daniel Baluta
@ 2014-12-18 16:13   ` Lars-Peter Clausen
  2014-12-26  9:39     ` Jonathan Cameron
  1 sibling, 1 reply; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-12-18 16:13 UTC (permalink / raw)
  To: Roberta Dobrescu, jic23, linux-iio
  Cc: octavian.purdila, daniel.baluta, Michael.Hennerich, knaack.h,
	pmeerw

On 12/16/2014 10:11 AM, Roberta Dobrescu wrote:
> This patch fixes the following checkpatch.pl warning:
> WARNING: braces {} are not necessary for single statement blocks
>
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-16  9:11 ` [PATCH 1/3] iio: frequency: Remove 'out of memory' message Roberta Dobrescu
  2014-12-16 11:22   ` Daniel Baluta
@ 2014-12-18 16:14   ` Lars-Peter Clausen
  2014-12-18 23:22   ` Hartmut Knaack
  2014-12-23  8:51   ` Daniel Baluta
  3 siblings, 0 replies; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-12-18 16:14 UTC (permalink / raw)
  To: Roberta Dobrescu, jic23, linux-iio
  Cc: octavian.purdila, daniel.baluta, Michael.Hennerich, knaack.h,
	pmeerw

On 12/16/2014 10:11 AM, Roberta Dobrescu wrote:
> This patch fixes the following checkpatch.pl warning:
> WARNING: Possible unnecessary 'out of memory' message
>
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>

Acked-by: Lars-Peter Clausen <lars@metafoo.de>

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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-16  9:11 ` [PATCH 1/3] iio: frequency: Remove 'out of memory' message Roberta Dobrescu
  2014-12-16 11:22   ` Daniel Baluta
  2014-12-18 16:14   ` Lars-Peter Clausen
@ 2014-12-18 23:22   ` Hartmut Knaack
  2014-12-23  8:51   ` Daniel Baluta
  3 siblings, 0 replies; 17+ messages in thread
From: Hartmut Knaack @ 2014-12-18 23:22 UTC (permalink / raw)
  To: Roberta Dobrescu, jic23, linux-iio
  Cc: octavian.purdila, daniel.baluta, lars, Michael.Hennerich, pmeerw

Roberta Dobrescu schrieb am 16.12.2014 um 10:11:
> This patch fixes the following checkpatch.pl warning:
> WARNING: Possible unnecessary 'out of memory' message
Hi Roberta,
I think this is slightly more complex. This function is used in adf4350_probe():

	if (spi->dev.of_node) {
		pdata = adf4350_parse_dt(&spi->dev);
		if (pdata == NULL)
			return -EINVAL;

Since pdata will only be NULL in the case, where you dropped the error message,
I think the EINVAL here should be changed to ENOMEM as well.
> 
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
> ---
>  drivers/iio/frequency/adf4350.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
> index 63a25d9..2b301eb 100644
> --- a/drivers/iio/frequency/adf4350.c
> +++ b/drivers/iio/frequency/adf4350.c
> @@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>  	int ret;
>  
>  	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -	if (!pdata) {
> -		dev_err(dev, "could not allocate memory for platform data\n");
> +	if (!pdata)
>  		return NULL;
> -	}
>  
>  	strncpy(&pdata->name[0], np->name, SPI_NAME_SIZE - 1);
>  
> 


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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-16  9:11 ` [PATCH 1/3] iio: frequency: Remove 'out of memory' message Roberta Dobrescu
                     ` (2 preceding siblings ...)
  2014-12-18 23:22   ` Hartmut Knaack
@ 2014-12-23  8:51   ` Daniel Baluta
  2014-12-23  9:07     ` Lars-Peter Clausen
  3 siblings, 1 reply; 17+ messages in thread
From: Daniel Baluta @ 2014-12-23  8:51 UTC (permalink / raw)
  To: Roberta Dobrescu
  Cc: Jonathan Cameron, linux-iio@vger.kernel.org,
	octavian.purdila@intel.com, Daniel Baluta, Lars-Peter Clausen,
	Michael.Hennerich, Hartmut Knaack, Peter Meerwald

On Tue, Dec 16, 2014 at 11:11 AM, Roberta Dobrescu
<roberta.dobrescu@gmail.com> wrote:
> This patch fixes the following checkpatch.pl warning:
> WARNING: Possible unnecessary 'out of memory' message
>
> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
> ---
>  drivers/iio/frequency/adf4350.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
> index 63a25d9..2b301eb 100644
> --- a/drivers/iio/frequency/adf4350.c
> +++ b/drivers/iio/frequency/adf4350.c
> @@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>         int ret;
>
>         pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
> -       if (!pdata) {
> -               dev_err(dev, "could not allocate memory for platform data\n");
> +       if (!pdata)
>                 return NULL;
> -       }
>
Based on Harmut's review we can return ERR_PTR(-ENOMEM) here
and then use IS_ERR and PTR_ERR inside adf4350_probe()

>         strncpy(&pdata->name[0], np->name, SPI_NAME_SIZE - 1);
>

thanks,
Daniel.

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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-23  8:51   ` Daniel Baluta
@ 2014-12-23  9:07     ` Lars-Peter Clausen
  2014-12-23  9:24       ` Daniel Baluta
  2014-12-23 20:21       ` Hartmut Knaack
  0 siblings, 2 replies; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-12-23  9:07 UTC (permalink / raw)
  To: Daniel Baluta
  Cc: Roberta Dobrescu, Jonathan Cameron, linux-iio@vger.kernel.org,
	octavian.purdila@intel.com, Michael.Hennerich, Hartmut Knaack,
	Peter Meerwald

On 12/23/2014 09:51 AM, Daniel Baluta wrote:
> On Tue, Dec 16, 2014 at 11:11 AM, Roberta Dobrescu
> <roberta.dobrescu@gmail.com> wrote:
>> This patch fixes the following checkpatch.pl warning:
>> WARNING: Possible unnecessary 'out of memory' message
>>
>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
>> ---
>>   drivers/iio/frequency/adf4350.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
>> index 63a25d9..2b301eb 100644
>> --- a/drivers/iio/frequency/adf4350.c
>> +++ b/drivers/iio/frequency/adf4350.c
>> @@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>>          int ret;
>>
>>          pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>> -       if (!pdata) {
>> -               dev_err(dev, "could not allocate memory for platform data\n");
>> +       if (!pdata)
>>                  return NULL;
>> -       }
>>
> Based on Harmut's review we can return ERR_PTR(-ENOMEM) here
> and then use IS_ERR and PTR_ERR inside adf4350_probe()

This patch is fine as it is. It removes the redundant error message. Every 
thing else should be done in a second patch.

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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-23  9:07     ` Lars-Peter Clausen
@ 2014-12-23  9:24       ` Daniel Baluta
  2014-12-23 20:21       ` Hartmut Knaack
  1 sibling, 0 replies; 17+ messages in thread
From: Daniel Baluta @ 2014-12-23  9:24 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Daniel Baluta, Roberta Dobrescu, Jonathan Cameron,
	linux-iio@vger.kernel.org, octavian.purdila@intel.com,
	Michael.Hennerich, Hartmut Knaack, Peter Meerwald

On Tue, Dec 23, 2014 at 11:07 AM, Lars-Peter Clausen <lars@metafoo.de> wrote:
> On 12/23/2014 09:51 AM, Daniel Baluta wrote:
>>
>> On Tue, Dec 16, 2014 at 11:11 AM, Roberta Dobrescu
>> <roberta.dobrescu@gmail.com> wrote:
>>>
>>> This patch fixes the following checkpatch.pl warning:
>>> WARNING: Possible unnecessary 'out of memory' message
>>>
>>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
>>> ---
>>>   drivers/iio/frequency/adf4350.c | 4 +---
>>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/iio/frequency/adf4350.c
>>> b/drivers/iio/frequency/adf4350.c
>>> index 63a25d9..2b301eb 100644
>>> --- a/drivers/iio/frequency/adf4350.c
>>> +++ b/drivers/iio/frequency/adf4350.c
>>> @@ -387,10 +387,8 @@ static struct adf4350_platform_data
>>> *adf4350_parse_dt(struct device *dev)
>>>          int ret;
>>>
>>>          pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>>> -       if (!pdata) {
>>> -               dev_err(dev, "could not allocate memory for platform
>>> data\n");
>>> +       if (!pdata)
>>>                  return NULL;
>>> -       }
>>>
>> Based on Harmut's review we can return ERR_PTR(-ENOMEM) here
>> and then use IS_ERR and PTR_ERR inside adf4350_probe()
>
>
> This patch is fine as it is. It removes the redundant error message. Every
> thing else should be done in a second patch.

That's better, indeed.

Daniel.

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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-23  9:07     ` Lars-Peter Clausen
  2014-12-23  9:24       ` Daniel Baluta
@ 2014-12-23 20:21       ` Hartmut Knaack
  2014-12-23 21:46         ` Lars-Peter Clausen
  1 sibling, 1 reply; 17+ messages in thread
From: Hartmut Knaack @ 2014-12-23 20:21 UTC (permalink / raw)
  To: Lars-Peter Clausen, Daniel Baluta
  Cc: Roberta Dobrescu, Jonathan Cameron, linux-iio@vger.kernel.org,
	octavian.purdila@intel.com, Michael.Hennerich, Peter Meerwald

Lars-Peter Clausen schrieb am 23.12.2014 um 10:07:
> On 12/23/2014 09:51 AM, Daniel Baluta wrote:
>> On Tue, Dec 16, 2014 at 11:11 AM, Roberta Dobrescu
>> <roberta.dobrescu@gmail.com> wrote:
>>> This patch fixes the following checkpatch.pl warning:
>>> WARNING: Possible unnecessary 'out of memory' message
>>>
>>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
>>> ---
>>>   drivers/iio/frequency/adf4350.c | 4 +---
>>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
>>> index 63a25d9..2b301eb 100644
>>> --- a/drivers/iio/frequency/adf4350.c
>>> +++ b/drivers/iio/frequency/adf4350.c
>>> @@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>>>          int ret;
>>>
>>>          pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>>> -       if (!pdata) {
>>> -               dev_err(dev, "could not allocate memory for platform data\n");
>>> +       if (!pdata)
>>>                  return NULL;
>>> -       }
>>>
>> Based on Harmut's review we can return ERR_PTR(-ENOMEM) here
>> and then use IS_ERR and PTR_ERR inside adf4350_probe()
> 
> This patch is fine as it is. It removes the redundant error message. Every 
> thing else should be done in a second patch.

I can't follow on this one. From what I see, if memory allocation fails here,
we will get an appropriate error message here, and _probe will pass up -EINVAL,
causing a misleading error message. Where do you see redundancy?

> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-23 20:21       ` Hartmut Knaack
@ 2014-12-23 21:46         ` Lars-Peter Clausen
  2014-12-26  9:38           ` Jonathan Cameron
  0 siblings, 1 reply; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-12-23 21:46 UTC (permalink / raw)
  To: Hartmut Knaack
  Cc: Daniel Baluta, Roberta Dobrescu, Jonathan Cameron,
	linux-iio@vger.kernel.org, octavian.purdila@intel.com,
	Michael.Hennerich, Peter Meerwald

On 12/23/2014 09:21 PM, Hartmut Knaack wrote:
> Lars-Peter Clausen schrieb am 23.12.2014 um 10:07:
>> On 12/23/2014 09:51 AM, Daniel Baluta wrote:
>>> On Tue, Dec 16, 2014 at 11:11 AM, Roberta Dobrescu
>>> <roberta.dobrescu@gmail.com> wrote:
>>>> This patch fixes the following checkpatch.pl warning:
>>>> WARNING: Possible unnecessary 'out of memory' message
>>>>
>>>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
>>>> ---
>>>>    drivers/iio/frequency/adf4350.c | 4 +---
>>>>    1 file changed, 1 insertion(+), 3 deletions(-)
>>>>
>>>> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
>>>> index 63a25d9..2b301eb 100644
>>>> --- a/drivers/iio/frequency/adf4350.c
>>>> +++ b/drivers/iio/frequency/adf4350.c
>>>> @@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>>>>           int ret;
>>>>
>>>>           pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>>>> -       if (!pdata) {
>>>> -               dev_err(dev, "could not allocate memory for platform data\n");
>>>> +       if (!pdata)
>>>>                   return NULL;
>>>> -       }
>>>>
>>> Based on Harmut's review we can return ERR_PTR(-ENOMEM) here
>>> and then use IS_ERR and PTR_ERR inside adf4350_probe()
>>
>> This patch is fine as it is. It removes the redundant error message. Every
>> thing else should be done in a second patch.
>
> I can't follow on this one. From what I see, if memory allocation fails here,
> we will get an appropriate error message here, and _probe will pass up -EINVAL,
> causing a misleading error message. Where do you see redundancy?

Unless you pass __GFP_NOWARN to k*alloc it will print a error message on its 
own if the allocation fails.

- Lars

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

* Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
  2014-12-23 21:46         ` Lars-Peter Clausen
@ 2014-12-26  9:38           ` Jonathan Cameron
  0 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2014-12-26  9:38 UTC (permalink / raw)
  To: Lars-Peter Clausen, Hartmut Knaack
  Cc: Daniel Baluta, Roberta Dobrescu, linux-iio@vger.kernel.org,
	octavian.purdila@intel.com, Michael.Hennerich, Peter Meerwald

On 23/12/14 21:46, Lars-Peter Clausen wrote:
> On 12/23/2014 09:21 PM, Hartmut Knaack wrote:
>> Lars-Peter Clausen schrieb am 23.12.2014 um 10:07:
>>> On 12/23/2014 09:51 AM, Daniel Baluta wrote:
>>>> On Tue, Dec 16, 2014 at 11:11 AM, Roberta Dobrescu
>>>> <roberta.dobrescu@gmail.com> wrote:
>>>>> This patch fixes the following checkpatch.pl warning:
>>>>> WARNING: Possible unnecessary 'out of memory' message
>>>>>
>>>>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
>>>>> ---
>>>>>    drivers/iio/frequency/adf4350.c | 4 +---
>>>>>    1 file changed, 1 insertion(+), 3 deletions(-)
>>>>>
>>>>> diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
>>>>> index 63a25d9..2b301eb 100644
>>>>> --- a/drivers/iio/frequency/adf4350.c
>>>>> +++ b/drivers/iio/frequency/adf4350.c
>>>>> @@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)
>>>>>           int ret;
>>>>>
>>>>>           pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
>>>>> -       if (!pdata) {
>>>>> -               dev_err(dev, "could not allocate memory for platform data\n");
>>>>> +       if (!pdata)
>>>>>                   return NULL;
>>>>> -       }
>>>>>
>>>> Based on Harmut's review we can return ERR_PTR(-ENOMEM) here
>>>> and then use IS_ERR and PTR_ERR inside adf4350_probe()
>>>
>>> This patch is fine as it is. It removes the redundant error message. Every
>>> thing else should be done in a second patch.
>>
>> I can't follow on this one. From what I see, if memory allocation fails here,
>> we will get an appropriate error message here, and _probe will pass up -EINVAL,
>> causing a misleading error message. Where do you see redundancy?
> 
> Unless you pass __GFP_NOWARN to k*alloc it will print a error message on its own if the allocation fails.
> 
Yes, separate issues - be it the case that they both want fixing.  Anyhow, have applied
this patch to the togreg branch of iio.git

Thanks


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

* Re: [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block
  2014-12-18 16:13   ` Lars-Peter Clausen
@ 2014-12-26  9:39     ` Jonathan Cameron
  0 siblings, 0 replies; 17+ messages in thread
From: Jonathan Cameron @ 2014-12-26  9:39 UTC (permalink / raw)
  To: Lars-Peter Clausen, Roberta Dobrescu, linux-iio
  Cc: octavian.purdila, daniel.baluta, Michael.Hennerich, knaack.h,
	pmeerw

On 18/12/14 16:13, Lars-Peter Clausen wrote:
> On 12/16/2014 10:11 AM, Roberta Dobrescu wrote:
>> This patch fixes the following checkpatch.pl warning:
>> WARNING: braces {} are not necessary for single statement blocks
>>
>> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com>
> 
> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
> 
Applied to the togreg branch of iio.git - initially pushed out as testing
etc etc.

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

end of thread, other threads:[~2014-12-26  9:39 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-16  9:11 [PATCH 0/3] iio: frequency: Fix checkpatch warnings Roberta Dobrescu
2014-12-16  9:11 ` [PATCH 1/3] iio: frequency: Remove 'out of memory' message Roberta Dobrescu
2014-12-16 11:22   ` Daniel Baluta
2014-12-18 16:14   ` Lars-Peter Clausen
2014-12-18 23:22   ` Hartmut Knaack
2014-12-23  8:51   ` Daniel Baluta
2014-12-23  9:07     ` Lars-Peter Clausen
2014-12-23  9:24       ` Daniel Baluta
2014-12-23 20:21       ` Hartmut Knaack
2014-12-23 21:46         ` Lars-Peter Clausen
2014-12-26  9:38           ` Jonathan Cameron
2014-12-16  9:11 ` [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block Roberta Dobrescu
2014-12-16 11:23   ` Daniel Baluta
2014-12-18 16:13   ` Lars-Peter Clausen
2014-12-26  9:39     ` Jonathan Cameron
2014-12-16  9:11 ` [PATCH 3/3] iio: frequency: Use usleep_range instead of msleep Roberta Dobrescu
2014-12-18 16:09   ` Lars-Peter Clausen

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