All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mfd/sm501: Adjustments for five function implementations
@ 2018-01-15 15:12 ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-15 15:12 UTC (permalink / raw)
  To: kernel-janitors, Lee Jones; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 Jan 2018 16:11:22 +0100

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Delete an error message for a failed memory allocation in two functions
  Improve a size determination in two functions
  Adjust 12 checks for null pointers

 drivers/mfd/sm501.c | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

-- 
2.15.1

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

* [PATCH 0/3] mfd/sm501: Adjustments for five function implementations
@ 2018-01-15 15:12 ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-15 15:12 UTC (permalink / raw)
  To: kernel-janitors, Lee Jones; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 Jan 2018 16:11:22 +0100

Two update suggestions were taken into account
from static source code analysis.

Markus Elfring (3):
  Delete an error message for a failed memory allocation in two functions
  Improve a size determination in two functions
  Adjust 12 checks for null pointers

 drivers/mfd/sm501.c | 34 +++++++++++++---------------------
 1 file changed, 13 insertions(+), 21 deletions(-)

-- 
2.15.1


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

* [PATCH 1/3] mfd/sm501: Delete an error message for a failed memory allocation in two functions
  2018-01-15 15:12 ` SF Markus Elfring
@ 2018-01-15 15:14   ` SF Markus Elfring
  -1 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-15 15:14 UTC (permalink / raw)
  To: kernel-janitors, Lee Jones; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 Jan 2018 15:40:46 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mfd/sm501.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index ad774161a22d..7298d6b571a1 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1385,7 +1385,6 @@ static int sm501_plat_probe(struct platform_device *dev)
 
 	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
 	if (sm == NULL) {
-		dev_err(&dev->dev, "no memory for device data\n");
 		ret = -ENOMEM;
 		goto err1;
 	}
@@ -1575,7 +1574,6 @@ static int sm501_pci_probe(struct pci_dev *dev,
 
 	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
 	if (sm == NULL) {
-		dev_err(&dev->dev, "no memory for device data\n");
 		err = -ENOMEM;
 		goto err1;
 	}
-- 
2.15.1

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

* [PATCH 1/3] mfd/sm501: Delete an error message for a failed memory allocation in two functions
@ 2018-01-15 15:14   ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-15 15:14 UTC (permalink / raw)
  To: kernel-janitors, Lee Jones; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 Jan 2018 15:40:46 +0100

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mfd/sm501.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index ad774161a22d..7298d6b571a1 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1385,7 +1385,6 @@ static int sm501_plat_probe(struct platform_device *dev)
 
 	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
 	if (sm = NULL) {
-		dev_err(&dev->dev, "no memory for device data\n");
 		ret = -ENOMEM;
 		goto err1;
 	}
@@ -1575,7 +1574,6 @@ static int sm501_pci_probe(struct pci_dev *dev,
 
 	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
 	if (sm = NULL) {
-		dev_err(&dev->dev, "no memory for device data\n");
 		err = -ENOMEM;
 		goto err1;
 	}
-- 
2.15.1


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

* [PATCH 2/3] mfd/sm501: Improve a size determination in two functions
  2018-01-15 15:12 ` SF Markus Elfring
@ 2018-01-15 15:15   ` SF Markus Elfring
  -1 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-15 15:15 UTC (permalink / raw)
  To: kernel-janitors, Lee Jones; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 Jan 2018 15:47:03 +0100

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mfd/sm501.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 7298d6b571a1..d5ab3481794a 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1380,10 +1380,9 @@ static int sm501_init_dev(struct sm501_devdata *sm)
 
 static int sm501_plat_probe(struct platform_device *dev)
 {
-	struct sm501_devdata *sm;
 	int ret;
+	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
 
-	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
 	if (sm == NULL) {
 		ret = -ENOMEM;
 		goto err1;
@@ -1569,10 +1568,9 @@ static struct sm501_platdata sm501_pci_platdata = {
 static int sm501_pci_probe(struct pci_dev *dev,
 				     const struct pci_device_id *id)
 {
-	struct sm501_devdata *sm;
 	int err;
+	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
 
-	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
 	if (sm == NULL) {
 		err = -ENOMEM;
 		goto err1;
-- 
2.15.1

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

* [PATCH 2/3] mfd/sm501: Improve a size determination in two functions
@ 2018-01-15 15:15   ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-15 15:15 UTC (permalink / raw)
  To: kernel-janitors, Lee Jones; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 Jan 2018 15:47:03 +0100

Replace the specification of data structures by pointer dereferences
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mfd/sm501.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 7298d6b571a1..d5ab3481794a 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1380,10 +1380,9 @@ static int sm501_init_dev(struct sm501_devdata *sm)
 
 static int sm501_plat_probe(struct platform_device *dev)
 {
-	struct sm501_devdata *sm;
 	int ret;
+	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
 
-	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
 	if (sm = NULL) {
 		ret = -ENOMEM;
 		goto err1;
@@ -1569,10 +1568,9 @@ static struct sm501_platdata sm501_pci_platdata = {
 static int sm501_pci_probe(struct pci_dev *dev,
 				     const struct pci_device_id *id)
 {
-	struct sm501_devdata *sm;
 	int err;
+	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
 
-	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
 	if (sm = NULL) {
 		err = -ENOMEM;
 		goto err1;
-- 
2.15.1


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

* [PATCH 3/3] mfd/sm501: Adjust 12 checks for null pointers
  2018-01-15 15:12 ` SF Markus Elfring
@ 2018-01-15 15:16   ` SF Markus Elfring
  -1 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-15 15:16 UTC (permalink / raw)
  To: kernel-janitors, Lee Jones; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 Jan 2018 16:00:22 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mfd/sm501.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index d5ab3481794a..726242f51003 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1050,13 +1050,13 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
 	spin_lock_init(&gpio->lock);
 
 	gpio->regs_res = request_mem_region(iobase, 0x20, "sm501-gpio");
-	if (gpio->regs_res == NULL) {
+	if (!gpio->regs_res) {
 		dev_err(sm->dev, "gpio: failed to request region\n");
 		return -ENXIO;
 	}
 
 	gpio->regs = ioremap(iobase, 0x20);
-	if (gpio->regs == NULL) {
+	if (!gpio->regs) {
 		dev_err(sm->dev, "gpio: failed to remap registers\n");
 		ret = -ENXIO;
 		goto err_claimed;
@@ -1358,7 +1358,7 @@ static int sm501_init_dev(struct sm501_devdata *sm)
 			sm501_register_gpio(sm);
 	}
 
-	if (pdata && pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) {
+	if (pdata && pdata->gpio_i2c && pdata->gpio_i2c_nr > 0) {
 		if (!sm501_gpio_isregistered(sm))
 			dev_err(sm->dev, "no gpio available for i2c gpio.\n");
 		else
@@ -1383,7 +1383,7 @@ static int sm501_plat_probe(struct platform_device *dev)
 	int ret;
 	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
 
-	if (sm == NULL) {
+	if (!sm) {
 		ret = -ENOMEM;
 		goto err1;
 	}
@@ -1401,8 +1401,7 @@ static int sm501_plat_probe(struct platform_device *dev)
 
 	sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
 	sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-
-	if (sm->io_res == NULL || sm->mem_res == NULL) {
+	if (!sm->io_res || !sm->mem_res) {
 		dev_err(&dev->dev, "failed to get IO resource\n");
 		ret = -ENOENT;
 		goto err_res;
@@ -1410,8 +1409,7 @@ static int sm501_plat_probe(struct platform_device *dev)
 
 	sm->regs_claim = request_mem_region(sm->io_res->start,
 					    0x100, "sm501");
-
-	if (sm->regs_claim == NULL) {
+	if (!sm->regs_claim) {
 		dev_err(&dev->dev, "cannot claim registers\n");
 		ret = -EBUSY;
 		goto err_res;
@@ -1420,8 +1418,7 @@ static int sm501_plat_probe(struct platform_device *dev)
 	platform_set_drvdata(dev, sm);
 
 	sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
-
-	if (sm->regs == NULL) {
+	if (!sm->regs) {
 		dev_err(&dev->dev, "cannot remap registers\n");
 		ret = -EIO;
 		goto err_claim;
@@ -1447,7 +1444,7 @@ static void sm501_set_power(struct sm501_devdata *sm, int on)
 {
 	struct sm501_platdata *pd = sm->platdata;
 
-	if (pd == NULL)
+	if (!pd)
 		return;
 
 	if (pd->get_power) {
@@ -1571,7 +1568,7 @@ static int sm501_pci_probe(struct pci_dev *dev,
 	int err;
 	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
 
-	if (sm == NULL) {
+	if (!sm) {
 		err = -ENOMEM;
 		goto err1;
 	}
@@ -1622,15 +1619,14 @@ static int sm501_pci_probe(struct pci_dev *dev,
 
 	sm->regs_claim = request_mem_region(sm->io_res->start,
 					    0x100, "sm501");
-	if (sm->regs_claim == NULL) {
+	if (!sm->regs_claim) {
 		dev_err(&dev->dev, "cannot claim registers\n");
 		err= -EBUSY;
 		goto err3;
 	}
 
 	sm->regs = pci_ioremap_bar(dev, 1);
-
-	if (sm->regs == NULL) {
+	if (!sm->regs) {
 		dev_err(&dev->dev, "cannot remap registers\n");
 		err = -EIO;
 		goto err4;
-- 
2.15.1

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

* [PATCH 3/3] mfd/sm501: Adjust 12 checks for null pointers
@ 2018-01-15 15:16   ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-15 15:16 UTC (permalink / raw)
  To: kernel-janitors, Lee Jones; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 Jan 2018 16:00:22 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The script “checkpatch.pl” pointed information out like the following.

Comparison to NULL could be written …

Thus fix the affected source code places.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/mfd/sm501.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index d5ab3481794a..726242f51003 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1050,13 +1050,13 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
 	spin_lock_init(&gpio->lock);
 
 	gpio->regs_res = request_mem_region(iobase, 0x20, "sm501-gpio");
-	if (gpio->regs_res = NULL) {
+	if (!gpio->regs_res) {
 		dev_err(sm->dev, "gpio: failed to request region\n");
 		return -ENXIO;
 	}
 
 	gpio->regs = ioremap(iobase, 0x20);
-	if (gpio->regs = NULL) {
+	if (!gpio->regs) {
 		dev_err(sm->dev, "gpio: failed to remap registers\n");
 		ret = -ENXIO;
 		goto err_claimed;
@@ -1358,7 +1358,7 @@ static int sm501_init_dev(struct sm501_devdata *sm)
 			sm501_register_gpio(sm);
 	}
 
-	if (pdata && pdata->gpio_i2c != NULL && pdata->gpio_i2c_nr > 0) {
+	if (pdata && pdata->gpio_i2c && pdata->gpio_i2c_nr > 0) {
 		if (!sm501_gpio_isregistered(sm))
 			dev_err(sm->dev, "no gpio available for i2c gpio.\n");
 		else
@@ -1383,7 +1383,7 @@ static int sm501_plat_probe(struct platform_device *dev)
 	int ret;
 	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
 
-	if (sm = NULL) {
+	if (!sm) {
 		ret = -ENOMEM;
 		goto err1;
 	}
@@ -1401,8 +1401,7 @@ static int sm501_plat_probe(struct platform_device *dev)
 
 	sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
 	sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
-
-	if (sm->io_res = NULL || sm->mem_res = NULL) {
+	if (!sm->io_res || !sm->mem_res) {
 		dev_err(&dev->dev, "failed to get IO resource\n");
 		ret = -ENOENT;
 		goto err_res;
@@ -1410,8 +1409,7 @@ static int sm501_plat_probe(struct platform_device *dev)
 
 	sm->regs_claim = request_mem_region(sm->io_res->start,
 					    0x100, "sm501");
-
-	if (sm->regs_claim = NULL) {
+	if (!sm->regs_claim) {
 		dev_err(&dev->dev, "cannot claim registers\n");
 		ret = -EBUSY;
 		goto err_res;
@@ -1420,8 +1418,7 @@ static int sm501_plat_probe(struct platform_device *dev)
 	platform_set_drvdata(dev, sm);
 
 	sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
-
-	if (sm->regs = NULL) {
+	if (!sm->regs) {
 		dev_err(&dev->dev, "cannot remap registers\n");
 		ret = -EIO;
 		goto err_claim;
@@ -1447,7 +1444,7 @@ static void sm501_set_power(struct sm501_devdata *sm, int on)
 {
 	struct sm501_platdata *pd = sm->platdata;
 
-	if (pd = NULL)
+	if (!pd)
 		return;
 
 	if (pd->get_power) {
@@ -1571,7 +1568,7 @@ static int sm501_pci_probe(struct pci_dev *dev,
 	int err;
 	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
 
-	if (sm = NULL) {
+	if (!sm) {
 		err = -ENOMEM;
 		goto err1;
 	}
@@ -1622,15 +1619,14 @@ static int sm501_pci_probe(struct pci_dev *dev,
 
 	sm->regs_claim = request_mem_region(sm->io_res->start,
 					    0x100, "sm501");
-	if (sm->regs_claim = NULL) {
+	if (!sm->regs_claim) {
 		dev_err(&dev->dev, "cannot claim registers\n");
 		err= -EBUSY;
 		goto err3;
 	}
 
 	sm->regs = pci_ioremap_bar(dev, 1);
-
-	if (sm->regs = NULL) {
+	if (!sm->regs) {
 		dev_err(&dev->dev, "cannot remap registers\n");
 		err = -EIO;
 		goto err4;
-- 
2.15.1


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

* Re: [PATCH 1/3] mfd/sm501: Delete an error message for a failed memory allocation in two functions
  2018-01-15 15:14   ` SF Markus Elfring
@ 2018-01-22 15:45     ` Lee Jones
  -1 siblings, 0 replies; 16+ messages in thread
From: Lee Jones @ 2018-01-22 15:45 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: kernel-janitors, LKML

On Mon, 15 Jan 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 15 Jan 2018 15:40:46 +0100
> 
> Omit an extra message for a memory allocation failure in these functions.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/mfd/sm501.c | 2 --
>  1 file changed, 2 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 1/3] mfd/sm501: Delete an error message for a failed memory allocation in two functions
@ 2018-01-22 15:45     ` Lee Jones
  0 siblings, 0 replies; 16+ messages in thread
From: Lee Jones @ 2018-01-22 15:45 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: kernel-janitors, LKML

On Mon, 15 Jan 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 15 Jan 2018 15:40:46 +0100
> 
> Omit an extra message for a memory allocation failure in these functions.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/mfd/sm501.c | 2 --
>  1 file changed, 2 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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] 16+ messages in thread

* Re: [PATCH 2/3] mfd/sm501: Improve a size determination in two functions
  2018-01-15 15:15   ` SF Markus Elfring
@ 2018-01-22 15:47     ` Lee Jones
  -1 siblings, 0 replies; 16+ messages in thread
From: Lee Jones @ 2018-01-22 15:47 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: kernel-janitors, LKML

On Mon, 15 Jan 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 15 Jan 2018 15:47:03 +0100
> 
> Replace the specification of data structures by pointer dereferences
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/mfd/sm501.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
> index 7298d6b571a1..d5ab3481794a 100644
> --- a/drivers/mfd/sm501.c
> +++ b/drivers/mfd/sm501.c
> @@ -1380,10 +1380,9 @@ static int sm501_init_dev(struct sm501_devdata *sm)
>  
>  static int sm501_plat_probe(struct platform_device *dev)
>  {
> -	struct sm501_devdata *sm;
>  	int ret;
> +	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
>  
> -	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);

Leave this here please.

Just s/struct sm501_devdata/*sm/

>  	if (sm == NULL) {
>  		ret = -ENOMEM;
>  		goto err1;
> @@ -1569,10 +1568,9 @@ static struct sm501_platdata sm501_pci_platdata = {
>  static int sm501_pci_probe(struct pci_dev *dev,
>  				     const struct pci_device_id *id)
>  {
> -	struct sm501_devdata *sm;
>  	int err;
> +	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
>  
> -	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);

As above.

>  	if (sm == NULL) {
>  		err = -ENOMEM;
>  		goto err1;

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 2/3] mfd/sm501: Improve a size determination in two functions
@ 2018-01-22 15:47     ` Lee Jones
  0 siblings, 0 replies; 16+ messages in thread
From: Lee Jones @ 2018-01-22 15:47 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: kernel-janitors, LKML

On Mon, 15 Jan 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 15 Jan 2018 15:47:03 +0100
> 
> Replace the specification of data structures by pointer dereferences
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
> 
> This issue was detected by using the Coccinelle software.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/mfd/sm501.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
> index 7298d6b571a1..d5ab3481794a 100644
> --- a/drivers/mfd/sm501.c
> +++ b/drivers/mfd/sm501.c
> @@ -1380,10 +1380,9 @@ static int sm501_init_dev(struct sm501_devdata *sm)
>  
>  static int sm501_plat_probe(struct platform_device *dev)
>  {
> -	struct sm501_devdata *sm;
>  	int ret;
> +	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
>  
> -	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);

Leave this here please.

Just s/struct sm501_devdata/*sm/

>  	if (sm = NULL) {
>  		ret = -ENOMEM;
>  		goto err1;
> @@ -1569,10 +1568,9 @@ static struct sm501_platdata sm501_pci_platdata = {
>  static int sm501_pci_probe(struct pci_dev *dev,
>  				     const struct pci_device_id *id)
>  {
> -	struct sm501_devdata *sm;
>  	int err;
> +	struct sm501_devdata *sm = kzalloc(sizeof(*sm), GFP_KERNEL);
>  
> -	sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);

As above.

>  	if (sm = NULL) {
>  		err = -ENOMEM;
>  		goto err1;

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" 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] 16+ messages in thread

* Re: [PATCH 3/3] mfd/sm501: Adjust 12 checks for null pointers
  2018-01-15 15:16   ` SF Markus Elfring
  (?)
@ 2018-01-22 15:49   ` Lee Jones
  2018-01-23 13:04     ` Lee Jones
  -1 siblings, 1 reply; 16+ messages in thread
From: Lee Jones @ 2018-01-22 15:49 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: kernel-janitors, LKML

On Mon, 15 Jan 2018, SF Markus Elfring wrote:

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Mon, 15 Jan 2018 16:00:22 +0100
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> The script “checkpatch.pl” pointed information out like the following.
> 
> Comparison to NULL could be written …
> 
> Thus fix the affected source code places.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
>  drivers/mfd/sm501.c | 26 +++++++++++---------------
>  1 file changed, 11 insertions(+), 15 deletions(-)

Applied, thanks.

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH 3/3] mfd/sm501: Adjust 12 checks for null pointers
  2018-01-22 15:49   ` Lee Jones
@ 2018-01-23 13:04     ` Lee Jones
  2018-01-23 13:34         ` SF Markus Elfring
  0 siblings, 1 reply; 16+ messages in thread
From: Lee Jones @ 2018-01-23 13:04 UTC (permalink / raw)
  To: SF Markus Elfring; +Cc: kernel-janitors, LKML

On Mon, 22 Jan 2018, Lee Jones wrote:

> On Mon, 15 Jan 2018, SF Markus Elfring wrote:
> 
> > From: Markus Elfring <elfring@users.sourceforge.net>
> > Date: Mon, 15 Jan 2018 16:00:22 +0100
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > 
> > The script “checkpatch.pl” pointed information out like the following.
> > 
> > Comparison to NULL could be written …
> > 
> > Thus fix the affected source code places.
> > 
> > Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> > ---
> >  drivers/mfd/sm501.c | 26 +++++++++++---------------
> >  1 file changed, 11 insertions(+), 15 deletions(-)
> 
> Applied, thanks.

This patch does not apply.

Please rebase and resend.

-- 
Lee Jones
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [3/3] mfd/sm501: Adjust 12 checks for null pointers
  2018-01-23 13:04     ` Lee Jones
@ 2018-01-23 13:34         ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-23 13:34 UTC (permalink / raw)
  To: Lee Jones; +Cc: kernel-janitors, LKML

> This patch does not apply.

This change possibility partly depends on the update step
“[PATCH 2/3] mfd/sm501: Improve a size determination in two functions”
which you did not like yesterday.
https://lkml.org/lkml/2018/1/22/564


> Please rebase and resend.

Will the change acceptance grow then really?

Do you find the proposed source code transformation generally acceptable?

Regards,
Markus

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

* Re: [3/3] mfd/sm501: Adjust 12 checks for null pointers
@ 2018-01-23 13:34         ` SF Markus Elfring
  0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2018-01-23 13:34 UTC (permalink / raw)
  To: Lee Jones; +Cc: kernel-janitors, LKML

> This patch does not apply.

This change possibility partly depends on the update step
“[PATCH 2/3] mfd/sm501: Improve a size determination in two functions”
which you did not like yesterday.
https://lkml.org/lkml/2018/1/22/564


> Please rebase and resend.

Will the change acceptance grow then really?

Do you find the proposed source code transformation generally acceptable?

Regards,
Markus

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

end of thread, other threads:[~2018-01-23 13:34 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-15 15:12 [PATCH 0/3] mfd/sm501: Adjustments for five function implementations SF Markus Elfring
2018-01-15 15:12 ` SF Markus Elfring
2018-01-15 15:14 ` [PATCH 1/3] mfd/sm501: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2018-01-15 15:14   ` SF Markus Elfring
2018-01-22 15:45   ` Lee Jones
2018-01-22 15:45     ` Lee Jones
2018-01-15 15:15 ` [PATCH 2/3] mfd/sm501: Improve a size determination " SF Markus Elfring
2018-01-15 15:15   ` SF Markus Elfring
2018-01-22 15:47   ` Lee Jones
2018-01-22 15:47     ` Lee Jones
2018-01-15 15:16 ` [PATCH 3/3] mfd/sm501: Adjust 12 checks for null pointers SF Markus Elfring
2018-01-15 15:16   ` SF Markus Elfring
2018-01-22 15:49   ` Lee Jones
2018-01-23 13:04     ` Lee Jones
2018-01-23 13:34       ` [3/3] " SF Markus Elfring
2018-01-23 13:34         ` SF Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.