* [PATCH v2 01/17 1/3] mfd: abx500-core: Delete an error message for a failed memory allocation in abx500_register_ops()
2018-03-09 16:00 ` [PATCH v2 0/3] mfd/abx500-core: Adjustments for eight function implementations SF Markus Elfring
@ 2018-03-09 16:01 ` SF Markus Elfring
2018-03-09 16:02 ` [PATCH v2 02/17 2/3] mfd: abx500-core: Improve two size determinations " SF Markus Elfring
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2018-03-09 16:01 UTC (permalink / raw)
To: linux-arm-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 02/17 2/3] mfd: abx500-core: Improve two size determinations in abx500_register_ops()
2018-03-09 16:00 ` [PATCH v2 0/3] mfd/abx500-core: Adjustments for eight function implementations SF Markus Elfring
2018-03-09 16:01 ` [PATCH v2 01/17 1/3] mfd: abx500-core: Delete an error message for a failed memory allocation in abx500_register_ops() SF Markus Elfring
@ 2018-03-09 16:02 ` SF Markus Elfring
2018-03-09 16:03 ` [PATCH v2 03/17 3/3] mfd: abx500-core: Adjust 14 checks for null pointers SF Markus Elfring
2018-03-24 14:25 ` [PATCH v2 0/3] mfd/abx500-core: Adjustments for eight function implementations Linus Walleij
3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2018-03-09 16:02 UTC (permalink / raw)
To: linux-arm-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 03/17 3/3] mfd: abx500-core: Adjust 14 checks for null pointers
2018-03-09 16:00 ` [PATCH v2 0/3] mfd/abx500-core: Adjustments for eight function implementations SF Markus Elfring
2018-03-09 16:01 ` [PATCH v2 01/17 1/3] mfd: abx500-core: Delete an error message for a failed memory allocation in abx500_register_ops() SF Markus Elfring
2018-03-09 16:02 ` [PATCH v2 02/17 2/3] mfd: abx500-core: Improve two size determinations " SF Markus Elfring
@ 2018-03-09 16:03 ` SF Markus Elfring
2018-03-24 14:25 ` [PATCH v2 0/3] mfd/abx500-core: Adjustments for eight function implementations Linus Walleij
3 siblings, 0 replies; 5+ messages in thread
From: SF Markus Elfring @ 2018-03-09 16:03 UTC (permalink / raw)
To: linux-arm-kernel
From: Markus Elfring <elfring@users.sourceforge.net>
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 <elfring@users.sourceforge.net>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread