2018-03-09 15:57:09

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 00/17] MFD: Adjustments for several function implementations

From: Markus Elfring <[email protected]>
Date: Fri, 9 Mar 2018 10:24:42 +0100

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

Markus Elfring (17):
abx500-core: Adjustments for eight function implementations
si476x-i2c: Delete an error message for a failed memory allocation
in si476x_core_probe()
sm501: Adjustments for five function implementations
smsc-ece1099: Improve a size determination in smsc_i2c_probe()
ti_am335x_tscadc: Delete an error message for a failed memory allocation
in ti_tscadc_probe()
tps65090: Delete an error message for a failed memory allocation
in tps65090_i2c_probe()
tps6586x: Delete an error message for a failed memory allocation
in tps6586x_parse_dt()
tps65910: Adjustments for four function implementations
tps80031: Delete an error message for a failed memory allocation
in tps80031_probe()
twl6030-irq: Delete an error message for a failed memory allocation
in twl6030_init_irq()
viperboard: Delete an error message for a failed memory allocation
in vprbrd_probe()
---

v2:
Lee Jones requested a resend for some of these patches. Thus several changes
were rebased on source files from Linux next-20180308.

drivers/mfd/abx500-core.c | 25 +++++++++++--------------
drivers/mfd/si476x-i2c.c | 6 ++----
drivers/mfd/sm501.c | 30 +++++++++++++-----------------
drivers/mfd/smsc-ece1099.c | 3 +--
drivers/mfd/ti_am335x_tscadc.c | 5 ++---
drivers/mfd/tps65090.c | 4 +---
drivers/mfd/tps6586x.c | 4 +---
drivers/mfd/tps65910.c | 18 ++++++++----------
drivers/mfd/tps80031.c | 4 +---
drivers/mfd/twl6030-irq.c | 4 +---
drivers/mfd/viperboard.c | 4 +---
11 files changed, 42 insertions(+), 65 deletions(-)

--
2.16.2



2018-03-09 16:02:28

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 0/3] mfd/abx500-core: Adjustments for eight function implementations

From: Markus Elfring <[email protected]>

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

Markus Elfring (3):
Delete an error message for a failed memory allocation
in abx500_register_ops()
Improve two size determinations in abx500_register_ops()
Adjust 14 checks for null pointers

Reviewed-by: Linus Walleij <[email protected]>
---

v2:
Lee Jones requested a resend for these patches. The changes were rebased
on source files from Linux next-20180308.

drivers/mfd/abx500-core.c | 25 +++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)

--
2.15.1


2018-03-09 16:03:57

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 01/17 1/3] mfd: abx500-core: Delete an error message for a failed memory allocation in abx500_register_ops()

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 11:44:33 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/abx500-core.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c
index 0d3846a4767c..c8c9d41abcaa 100644
--- a/drivers/mfd/abx500-core.c
+++ b/drivers/mfd/abx500-core.c
@@ -40,10 +40,9 @@ int abx500_register_ops(struct device *dev, struct abx500_ops *ops)
dev_entry = devm_kzalloc(dev,
sizeof(struct abx500_device_entry),
GFP_KERNEL);
- if (!dev_entry) {
- dev_err(dev, "register_ops kzalloc failed");
+ if (!dev_entry)
return -ENOMEM;
- }
+
dev_entry->dev = dev;
memcpy(&dev_entry->ops, ops, sizeof(struct abx500_ops));

--
2.16.2


2018-03-09 16:04:43

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 02/17 2/3] mfd: abx500-core: Improve two size determinations in abx500_register_ops()

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 12:46:47 +0100

Replace the specification of two 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 <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/abx500-core.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c
index c8c9d41abcaa..17176e91cbd0 100644
--- a/drivers/mfd/abx500-core.c
+++ b/drivers/mfd/abx500-core.c
@@ -37,14 +37,12 @@ int abx500_register_ops(struct device *dev, struct abx500_ops *ops)
{
struct abx500_device_entry *dev_entry;

- dev_entry = devm_kzalloc(dev,
- sizeof(struct abx500_device_entry),
- GFP_KERNEL);
+ dev_entry = devm_kzalloc(dev, sizeof(*dev_entry), GFP_KERNEL);
if (!dev_entry)
return -ENOMEM;

dev_entry->dev = dev;
- memcpy(&dev_entry->ops, ops, sizeof(struct abx500_ops));
+ memcpy(&dev_entry->ops, ops, sizeof(*ops));

list_add_tail(&dev_entry->list, &abx500_list);
return 0;
--
2.16.2


2018-03-09 16:05:32

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 03/17 3/3] mfd: abx500-core: Adjust 14 checks for null pointers

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 12:50:12 +0100

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 <[email protected]>
Reviewed-by: Linus Walleij <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/abx500-core.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c
index 17176e91cbd0..f282d39a5917 100644
--- a/drivers/mfd/abx500-core.c
+++ b/drivers/mfd/abx500-core.c
@@ -65,7 +65,7 @@ int abx500_set_register_interruptible(struct device *dev, u8 bank, u8 reg,
struct abx500_ops *ops;

lookup_ops(dev->parent, &ops);
- if ((ops != NULL) && (ops->set_register != NULL))
+ if (ops && ops->set_register)
return ops->set_register(dev, bank, reg, value);
else
return -ENOTSUPP;
@@ -78,7 +78,7 @@ int abx500_get_register_interruptible(struct device *dev, u8 bank, u8 reg,
struct abx500_ops *ops;

lookup_ops(dev->parent, &ops);
- if ((ops != NULL) && (ops->get_register != NULL))
+ if (ops && ops->get_register)
return ops->get_register(dev, bank, reg, value);
else
return -ENOTSUPP;
@@ -91,7 +91,7 @@ int abx500_get_register_page_interruptible(struct device *dev, u8 bank,
struct abx500_ops *ops;

lookup_ops(dev->parent, &ops);
- if ((ops != NULL) && (ops->get_register_page != NULL))
+ if (ops && ops->get_register_page)
return ops->get_register_page(dev, bank,
first_reg, regvals, numregs);
else
@@ -105,7 +105,7 @@ int abx500_mask_and_set_register_interruptible(struct device *dev, u8 bank,
struct abx500_ops *ops;

lookup_ops(dev->parent, &ops);
- if ((ops != NULL) && (ops->mask_and_set_register != NULL))
+ if (ops && ops->mask_and_set_register)
return ops->mask_and_set_register(dev, bank,
reg, bitmask, bitvalues);
else
@@ -118,7 +118,7 @@ int abx500_get_chip_id(struct device *dev)
struct abx500_ops *ops;

lookup_ops(dev->parent, &ops);
- if ((ops != NULL) && (ops->get_chip_id != NULL))
+ if (ops && ops->get_chip_id)
return ops->get_chip_id(dev);
else
return -ENOTSUPP;
@@ -130,7 +130,7 @@ int abx500_event_registers_startup_state_get(struct device *dev, u8 *event)
struct abx500_ops *ops;

lookup_ops(dev->parent, &ops);
- if ((ops != NULL) && (ops->event_registers_startup_state_get != NULL))
+ if (ops && ops->event_registers_startup_state_get)
return ops->event_registers_startup_state_get(dev, event);
else
return -ENOTSUPP;
@@ -142,7 +142,7 @@ int abx500_startup_irq_enabled(struct device *dev, unsigned int irq)
struct abx500_ops *ops;

lookup_ops(dev->parent, &ops);
- if ((ops != NULL) && (ops->startup_irq_enabled != NULL))
+ if (ops && ops->startup_irq_enabled)
return ops->startup_irq_enabled(dev, irq);
else
return -ENOTSUPP;
--
2.16.2


2018-03-09 16:08:48

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 04/17] mfd: si476x-i2c: Delete an error message for a failed memory allocation in si476x_core_probe()

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 13:45:31 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/si476x-i2c.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/si476x-i2c.c b/drivers/mfd/si476x-i2c.c
index e6a3d999a376..2c5ec93333c3 100644
--- a/drivers/mfd/si476x-i2c.c
+++ b/drivers/mfd/si476x-i2c.c
@@ -697,11 +697,9 @@ static int si476x_core_probe(struct i2c_client *client,
int cell_num;

core = devm_kzalloc(&client->dev, sizeof(*core), GFP_KERNEL);
- if (!core) {
- dev_err(&client->dev,
- "failed to allocate 'struct si476x_core'\n");
+ if (!core)
return -ENOMEM;
- }
+
core->client = client;

core->regmap = devm_regmap_init_si476x(core);
--
2.16.2


2018-03-09 16:12:11

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 0/2] mfd/sm501: Adjustments for five function implementations

From: Markus Elfring <[email protected]>

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

Markus Elfring (2):
Improve a size determination in two functions
Adjust 12 checks for null pointers
---

v2:
Lee Jones requested a resend for these patches. The changes were rebased
on source files from Linux next-20180308.

drivers/mfd/sm501.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)

--
2.15.1


2018-03-09 16:14:06

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 05/17 1/2] mfd: sm501: Improve a size determination in two functions

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 14:05:41 +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 <[email protected]>
---

v2:
Lee Jones requested a different source code layout for this transformation.
The change was rebased on source files from Linux next-20180308.

drivers/mfd/sm501.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 7298d6b571a1..4f4957ea8fa3 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1383,7 +1383,7 @@ static int sm501_plat_probe(struct platform_device *dev)
struct sm501_devdata *sm;
int ret;

- sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
+ sm = kzalloc(sizeof(*sm), GFP_KERNEL);
if (sm == NULL) {
ret = -ENOMEM;
goto err1;
@@ -1572,7 +1572,7 @@ static int sm501_pci_probe(struct pci_dev *dev,
struct sm501_devdata *sm;
int err;

- sm = kzalloc(sizeof(struct sm501_devdata), GFP_KERNEL);
+ sm = kzalloc(sizeof(*sm), GFP_KERNEL);
if (sm == NULL) {
err = -ENOMEM;
goto err1;
--
2.16.2


2018-03-09 16:16:12

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 06/17 2/2] mfd: sm501: Adjust 12 checks for null pointers

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 14:20:06 +0100

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 <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

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 4f4957ea8fa3..55d19fd0994e 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
@@ -1384,7 +1384,7 @@ static int sm501_plat_probe(struct platform_device *dev)
int ret;

sm = kzalloc(sizeof(*sm), GFP_KERNEL);
- if (sm == NULL) {
+ if (!sm) {
ret = -ENOMEM;
goto err1;
}
@@ -1402,8 +1402,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;
@@ -1411,8 +1410,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;
@@ -1421,8 +1419,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;
@@ -1448,7 +1445,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) {
@@ -1573,7 +1570,7 @@ static int sm501_pci_probe(struct pci_dev *dev,
int err;

sm = kzalloc(sizeof(*sm), GFP_KERNEL);
- if (sm == NULL) {
+ if (!sm) {
err = -ENOMEM;
goto err1;
}
@@ -1624,15 +1621,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.16.2


2018-03-09 16:18:32

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 07/17] mfd: smsc-ece1099: Improve a size determination in smsc_i2c_probe()

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 15:05:16 +0100

Replace the specification of a data structure by a pointer dereference
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 <[email protected]>
---

v2:
Lee Jones requested a different source code layout for this transformation.
The change was rebased on source files from Linux next-20180308.

drivers/mfd/smsc-ece1099.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mfd/smsc-ece1099.c b/drivers/mfd/smsc-ece1099.c
index b9d96651cc0d..57b792eb58fd 100644
--- a/drivers/mfd/smsc-ece1099.c
+++ b/drivers/mfd/smsc-ece1099.c
@@ -37,8 +37,7 @@ static int smsc_i2c_probe(struct i2c_client *i2c,
int devid, rev, venid_l, venid_h;
int ret;

- smsc = devm_kzalloc(&i2c->dev, sizeof(struct smsc),
- GFP_KERNEL);
+ smsc = devm_kzalloc(&i2c->dev, sizeof(*smsc), GFP_KERNEL);
if (!smsc)
return -ENOMEM;

--
2.16.2


2018-03-09 16:20:26

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 08/17] mfd: ti_am335x_tscadc: Delete an error message for a failed memory allocation in ti_tscadc_probe()

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 15:15:51 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/ti_am335x_tscadc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 3cd958a31f36..47012c0899cd 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -169,10 +169,9 @@ static int ti_tscadc_probe(struct platform_device *pdev)

/* Allocate memory for device */
tscadc = devm_kzalloc(&pdev->dev, sizeof(*tscadc), GFP_KERNEL);
- if (!tscadc) {
- dev_err(&pdev->dev, "failed to allocate memory.\n");
+ if (!tscadc)
return -ENOMEM;
- }
+
tscadc->dev = &pdev->dev;

err = platform_get_irq(pdev, 0);
--
2.16.2


2018-03-09 16:21:29

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 09/17] mfd: tps65090: Delete an error message for a failed memory allocation in tps65090_i2c_probe()

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 15:25:58 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/tps65090.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/tps65090.c b/drivers/mfd/tps65090.c
index d7ec318c40c3..f13e4cd06e89 100644
--- a/drivers/mfd/tps65090.c
+++ b/drivers/mfd/tps65090.c
@@ -192,10 +192,8 @@ static int tps65090_i2c_probe(struct i2c_client *client,
irq_base = pdata->irq_base;

tps65090 = devm_kzalloc(&client->dev, sizeof(*tps65090), GFP_KERNEL);
- if (!tps65090) {
- dev_err(&client->dev, "mem alloc for tps65090 failed\n");
+ if (!tps65090)
return -ENOMEM;
- }

tps65090->dev = &client->dev;
i2c_set_clientdata(client, tps65090);
--
2.16.2


2018-03-09 16:25:00

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 10/17] mfd: tps6586x: Delete an error message for a failed memory allocation in tps6586x_parse_dt()

From: Markus Elfring <[email protected]>
Date: Thu, 8 Mar 2018 15:30:54 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/tps6586x.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index 5628a6b5b19b..b89379782741 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -423,10 +423,8 @@ static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *clien
struct tps6586x_platform_data *pdata;

pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata) {
- dev_err(&client->dev, "Memory allocation failed\n");
+ if (!pdata)
return NULL;
- }

pdata->num_subdevs = 0;
pdata->subdevs = NULL;
--
2.16.2


2018-03-09 16:25:50

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 0/4] mfd/tps65910: Adjustments for four function implementations

From: Markus Elfring <[email protected]>

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

Markus Elfring (4):
Delete an error message for a failed memory allocation in tps65910_parse_dt()
Delete an unnecessary variable initialisation in four functions
Delete an unnecessary variable initialisation in tps65910_sleepinit()
Move an assignment in tps65910_sleepinit()
---

v2:
Lee Jones requested a resend for these patches. The changes were rebased
on source files from Linux next-20180308.

drivers/mfd/tps65910.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

--
2.15.1


2018-03-09 16:30:19

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 11/17] mfd: tps65910: Delete an error message for a failed memory allocation in tps65910_parse_dt()

From: Markus Elfring <[email protected]>
Date: Fri, 9 Mar 2018 09:00:59 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/tps65910.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index 8263605f6d2f..555bd394efc3 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -395,10 +395,8 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,

board_info = devm_kzalloc(&client->dev, sizeof(*board_info),
GFP_KERNEL);
- if (!board_info) {
- dev_err(&client->dev, "Failed to allocate pdata\n");
+ if (!board_info)
return NULL;
- }

ret = of_property_read_u32(np, "ti,vmbch-threshold", &prop);
if (!ret)
--
2.16.2


2018-03-09 16:38:39

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 12/17 2/4] mfd: tps65910: Delete an unnecessary variable initialisation in four functions

From: Markus Elfring <[email protected]>
Date: Fri, 9 Mar 2018 09:06:14 +0100

The local variable "ret" will be set to an appropriate value a bit later.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/tps65910.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index 555bd394efc3..80ea1474c654 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -229,7 +229,7 @@ static struct regmap_irq_chip tps65910_irq_chip = {
static int tps65910_irq_init(struct tps65910 *tps65910, int irq,
struct tps65910_platform_data *pdata)
{
- int ret = 0;
+ int ret;
static struct regmap_irq_chip *tps6591x_irqs_chip;

if (!irq) {
@@ -313,7 +313,7 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
struct tps65910_board *pmic_pdata)
{
struct device *dev = NULL;
- int ret = 0;
+ int ret;

dev = tps65910->dev;

@@ -383,7 +383,7 @@ static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
struct tps65910_board *board_info;
unsigned int prop;
const struct of_device_id *match;
- int ret = 0;
+ int ret;

match = of_match_device(tps65910_of_match, &client->dev);
if (!match) {
@@ -460,7 +460,7 @@ static int tps65910_i2c_probe(struct i2c_client *i2c,
struct tps65910_board *of_pmic_plat_data = NULL;
struct tps65910_platform_data *init_data;
unsigned long chip_id = id->driver_data;
- int ret = 0;
+ int ret;

pmic_plat_data = dev_get_platdata(&i2c->dev);

--
2.16.2


2018-03-09 16:42:24

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 13/17 3/4] mfd: tps65910: Delete an unnecessary variable initialisation in tps65910_sleepinit()

From: Markus Elfring <[email protected]>
Date: Fri, 9 Mar 2018 09:10:09 +0100

The local variable "dev" will be reassigned by a following statement.
Thus omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/tps65910.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index 80ea1474c654..7e7d3d1642c6 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -312,7 +312,7 @@ static int tps65910_ck32k_init(struct tps65910 *tps65910,
static int tps65910_sleepinit(struct tps65910 *tps65910,
struct tps65910_board *pmic_pdata)
{
- struct device *dev = NULL;
+ struct device *dev;
int ret;

dev = tps65910->dev;
--
2.16.2


2018-03-09 16:43:50

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 14/17 4/4] mfd: tps65910: Move an assignment in tps65910_sleepinit()

From: Markus Elfring <[email protected]>
Date: Fri, 9 Mar 2018 09:19:42 +0100

Move the assignment for the local variable "dev" so that its setting
will be performed after a configuration check by this function.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/tps65910.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
index 7e7d3d1642c6..bf16cbe6fd88 100644
--- a/drivers/mfd/tps65910.c
+++ b/drivers/mfd/tps65910.c
@@ -315,11 +315,11 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
struct device *dev;
int ret;

- dev = tps65910->dev;
-
if (!pmic_pdata->en_dev_slp)
return 0;

+ dev = tps65910->dev;
+
/* enabling SLEEP device state */
ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL,
DEVCTRL_DEV_SLP_MASK);
--
2.16.2


2018-03-09 16:48:17

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 15/17] mfd: tps80031: Delete an error message for a failed memory allocation in tps80031_probe()

From: Markus Elfring <[email protected]>
Date: Fri, 9 Mar 2018 09:45:13 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/tps80031.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/tps80031.c b/drivers/mfd/tps80031.c
index 0812df3b0d47..608c7f77830e 100644
--- a/drivers/mfd/tps80031.c
+++ b/drivers/mfd/tps80031.c
@@ -431,10 +431,8 @@ static int tps80031_probe(struct i2c_client *client,
}

tps80031 = devm_kzalloc(&client->dev, sizeof(*tps80031), GFP_KERNEL);
- if (!tps80031) {
- dev_err(&client->dev, "Malloc failed for tps80031\n");
+ if (!tps80031)
return -ENOMEM;
- }

for (i = 0; i < TPS80031_NUM_SLAVES; i++) {
if (tps80031_slave_address[i] == client->addr)
--
2.16.2


2018-03-09 16:51:54

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 16/17] mfd: twl6030-irq: Delete an error message for a failed memory allocation in twl6030_init_irq()

From: Markus Elfring <[email protected]>
Date: Fri, 9 Mar 2018 09:49:32 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/twl6030-irq.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
index e3ec8dfa9f1e..e939431ed10c 100644
--- a/drivers/mfd/twl6030-irq.c
+++ b/drivers/mfd/twl6030-irq.c
@@ -392,10 +392,8 @@ int twl6030_init_irq(struct device *dev, int irq_num)
nr_irqs = TWL6030_NR_IRQS;

twl6030_irq = devm_kzalloc(dev, sizeof(*twl6030_irq), GFP_KERNEL);
- if (!twl6030_irq) {
- dev_err(dev, "twl6030_irq: Memory allocation failed\n");
+ if (!twl6030_irq)
return -ENOMEM;
- }

mask[0] = 0xFF;
mask[1] = 0xFF;
--
2.16.2


2018-03-09 16:52:17

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH v2 17/17] mfd: viperboard: Delete an error message for a failed memory allocation in vprbrd_probe()

From: Markus Elfring <[email protected]>
Date: Fri, 9 Mar 2018 09:56:31 +0100

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

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---

v2:
Lee Jones requested a resend for this patch. The change was rebased
on source files from Linux next-20180308.

drivers/mfd/viperboard.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mfd/viperboard.c b/drivers/mfd/viperboard.c
index e6b3c70aeb22..e9f61262d583 100644
--- a/drivers/mfd/viperboard.c
+++ b/drivers/mfd/viperboard.c
@@ -59,10 +59,8 @@ static int vprbrd_probe(struct usb_interface *interface,

/* allocate memory for our device state and initialize it */
vb = kzalloc(sizeof(*vb), GFP_KERNEL);
- if (vb == NULL) {
- dev_err(&interface->dev, "Out of memory\n");
+ if (!vb)
return -ENOMEM;
- }

mutex_init(&vb->lock);

--
2.16.2


2018-03-12 08:59:01

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH v2 14/17 4/4] mfd: tps65910: Move an assignment in tps65910_sleepinit()

On Fri, 09 Mar 2018, SF Markus Elfring wrote:

> From: Markus Elfring <[email protected]>
> Date: Fri, 9 Mar 2018 09:19:42 +0100
>
> Move the assignment for the local variable "dev" so that its setting
> will be performed after a configuration check by this function.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---
>
> v2:
> Lee Jones requested a resend for this patch. The change was rebased
> on source files from Linux next-20180308.

Thanks.

What happened here: [PATCH v2 14/17 4/4]

How have you managed to insert 4 patches into the x/17 thread?

It shouldn't matter for reviewing purposes. It just looks really
odd.

> drivers/mfd/tps65910.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mfd/tps65910.c b/drivers/mfd/tps65910.c
> index 7e7d3d1642c6..bf16cbe6fd88 100644
> --- a/drivers/mfd/tps65910.c
> +++ b/drivers/mfd/tps65910.c
> @@ -315,11 +315,11 @@ static int tps65910_sleepinit(struct tps65910 *tps65910,
> struct device *dev;
> int ret;
>
> - dev = tps65910->dev;
> -
> if (!pmic_pdata->en_dev_slp)
> return 0;
>
> + dev = tps65910->dev;
> +
> /* enabling SLEEP device state */
> ret = tps65910_reg_set_bits(tps65910, TPS65910_DEVCTRL,
> DEVCTRL_DEV_SLP_MASK);

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

2018-03-13 07:15:12

by SF Markus Elfring

[permalink] [raw]
Subject: Re: [v2 14/17 4/4] mfd: tps65910: Checking patch structures

> How have you managed to insert 4 patches into the x/17 thread?

I dared to group the desired patch series into dedicated mail threads.

Regards,
Markus

2018-03-13 07:58:12

by Lee Jones

[permalink] [raw]
Subject: Re: [v2 14/17 4/4] mfd: tps65910: Checking patch structures

On Tue, 13 Mar 2018, SF Markus Elfring wrote:

> > How have you managed to insert 4 patches into the x/17 thread?
>
> I dared to group the desired patch series into dedicated mail threads.

Interesting. I've never seen that done before.

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

2018-03-24 14:26:18

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH v2 0/3] mfd/abx500-core: Adjustments for eight function implementations

On Fri, Mar 9, 2018 at 5:00 PM, SF Markus Elfring
<[email protected]> wrote:

> From: Markus Elfring <[email protected]>
>
> Three update suggestions were taken into account
> from static source code analysis.

The series:
Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2018-03-27 08:04:36

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH v2 00/17] MFD: Adjustments for several function implementations

On Fri, 09 Mar 2018, SF Markus Elfring wrote:

> From: Markus Elfring <[email protected]>
> Date: Fri, 9 Mar 2018 10:24:42 +0100
>
> Several update suggestions were taken into account
> from static source code analysis.

All applied, thanks.

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