iio: frequency: Fix checkpatch warnings
Subsystems (2)
PATCH 1/3 iio: frequency: Remove 'out of memory' message
In reply to Roberta DobrescuThis patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' message
--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/iio/frequency/adf4350.c +1 -3
@@ -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 );
Signature · 1 line
1.9.1
PATCH 2/3 iio: frequency: Remove unnecessary braces around single statement block
In reply to Roberta DobrescuThis patch fixes the following checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks
--- drivers/iio/frequency/adf4350.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iio/frequency/adf4350.c +1 -2
@@ -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 ; }
Signature · 1 line
1.9.1
PATCH 3/3 iio: frequency: Use usleep_range instead of msleep
In reply to Roberta DobrescuThis patch fixes the following checkpatch.pl warning:
WARNING: msleep < 20ms can sleep for up to 20ms
--- drivers/iio/frequency/ad9523.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/frequency/ad9523.c +1 -1
@@ -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)
Signature · 1 line
1.9.1
cover iio: frequency: Fix checkpatch warnings
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(-)
Signature · 1 line
1.9.1
Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
In reply to Roberta DobrescuQuoted 4 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' messageSigned-off-by Roberta Dobrescu <[email protected]>
Quoted 27 lines
--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/iio/frequency/adf4350.c +1
-4@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block
In reply to Roberta DobrescuQuoted 4 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocksSigned-off-by Roberta Dobrescu <[email protected]>
Quoted 26 lines
--- drivers/iio/frequency/adf4350.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/iio/frequency/adf4350.c +1
-3@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] iio: frequency: Use usleep_range instead of msleep
In reply to Roberta DobrescuQuoted 13 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: msleep < 20ms can sleep for up to 20msSigned-off-by Roberta Dobrescu <[email protected]>--- drivers/iio/frequency/ad9523.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/frequency/ad9523.c +0
-0
drivers/iio/frequency/ad9523.c static int ad9523_store_eeprom(struct iio_dev *indio_dev) · line 448
Quoted 5 lines
drivers/iio/frequency/ad9523.c +1
-1@@ -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).
Quoted 4 lines
drivers/iio/frequency/ad9523.c +0
-0ret =ad9523_read (indio_dev,AD9523_EEPROM_DATA_XFER_STATUS );if (ret <0 )
Re: [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block
In reply to Roberta DobrescuQuoted 4 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocksSigned-off-by Roberta Dobrescu <[email protected]>
Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
In reply to Roberta DobrescuQuoted 4 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' messageSigned-off-by Roberta Dobrescu <[email protected]>
Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
In reply to Roberta DobrescuRoberta Dobrescu schrieb am 16.12.2014 um 10:11:
Quoted 2 lines
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.
Quoted 23 lines
Signed-off-by Roberta Dobrescu <[email protected]>--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/iio/frequency/adf4350.c +1
-3@@ -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 );
Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
In reply to Roberta DobrescuQuoted 13 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' messageSigned-off-by Roberta Dobrescu <[email protected]>--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/iio/frequency/adf4350.c +0
-0
drivers/iio/frequency/adf4350.c static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev) · line 392
Quoted 9 lines
drivers/iio/frequency/adf4350.c +1
-3@@ -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()
drivers/iio/frequency/adf4350.c static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev) · line 394
Quoted 2 lines
drivers/iio/frequency/adf4350.c +0
-0strncpy (&pdata->name[0 ], np->name,SPI_NAME_SIZE -1 );
thanks,
Daniel.
Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
Quoted 17 lines · Daniel Baluta
Quoted 15 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' messageSigned-off-by Roberta Dobrescu <[email protected]>--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/iio/frequency/adf4350.c +0
-0@@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)int ret;
Quoted 9 lines
drivers/iio/frequency/adf4350.c static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev) · line 392
Quoted 7 lines
drivers/iio/frequency/adf4350.c +1
-3pdata =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 useIS_ERRandPTR_ERRinsideadf4350_probe()
This patch is fine as it is. It removes the redundant error message. Every thing else should be done in a second patch.
Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
Quoted 34 lines · Lars-Peter Clausen
Quoted 21 lines · Daniel Baluta
Quoted 18 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' messageSigned-off-by Roberta Dobrescu <[email protected]>--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/iio/frequency/adf4350.c +0
-0@@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)int ret;Quoted 10 lines
drivers/iio/frequency/adf4350.c static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev) · line 392
Quoted 8 lines
drivers/iio/frequency/adf4350.c +1
-3pdata =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 useIS_ERRandPTR_ERRinsideadf4350_probe()
Quoted 2 lines
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.
Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
In reply to Lars-Peter ClausenLars-Peter Clausen schrieb am 23.12.2014 um 10:07:
Quoted 28 lines · Daniel Baluta
Quoted 17 lines
Quoted 15 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' messageSigned-off-by Roberta Dobrescu <[email protected]>--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/iio/frequency/adf4350.c +0
-0@@ -387,10 +387,8 @@ static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev)int ret;Quoted 9 lines
drivers/iio/frequency/adf4350.c static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev) · line 392
Quoted 7 lines
drivers/iio/frequency/adf4350.c +1
-3pdata =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 useIS_ERRandPTR_ERRinsideadf4350_probe()
Quoted 2 lines
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?
Quoted 6 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
Quoted 29 lines · Hartmut Knaack
Lars-Peter Clausen schrieb am 23.12.2014 um 10:07:
Quoted 28 lines · Daniel Baluta
Quoted 26 lines
Quoted 13 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' messageSigned-off-by Roberta Dobrescu <[email protected]>--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/iio/frequency/adf4350.c +0
-0drivers/iio/frequency/adf4350.c static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev) · line 392
Quoted 9 lines
drivers/iio/frequency/adf4350.c +1
-3@@ -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 useIS_ERRandPTR_ERRinsideadf4350_probe()
Quoted 6 lines
Quoted 2 lines
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
_probewill 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
Jonathan Cameron
maintainerRe: [PATCH 1/3] iio: frequency: Remove 'out of memory' message
Quoted 30 lines · Lars-Peter Clausen
Quoted 29 lines · Hartmut Knaack
Lars-Peter Clausen schrieb am 23.12.2014 um 10:07:
Quoted 28 lines · Daniel Baluta
Quoted 26 lines
Quoted 13 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: Possible unnecessary 'out of memory' messageSigned-off-by Roberta Dobrescu <[email protected]>--- drivers/iio/frequency/adf4350.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)drivers/iio/frequency/adf4350.c +0
-0drivers/iio/frequency/adf4350.c static struct adf4350_platform_data *adf4350_parse_dt(struct device *dev) · line 392
Quoted 9 lines
drivers/iio/frequency/adf4350.c +1
-3@@ -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 useIS_ERRandPTR_ERRinsideadf4350_probe()
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
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
_probewill pass up-EINVAL, causing a misleading error message. Where do you see redundancy?Unless you pass
__GFP_NOWARNto 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
Jonathan Cameron
maintainerRe: [PATCH 2/3] iio: frequency: Remove unnecessary braces around single statement block
In reply to Lars-Peter ClausenQuoted 8 lines · Lars-Peter Clausen
Quoted 4 lines · Roberta Dobrescu
This patch fixes the following checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocksSigned-off-by Roberta Dobrescu <[email protected]>
Applied to the togreg branch of iio.git - initially pushed out as testing etc etc.