Skip to contentSkip to conversation

Ux500 clock: Adjustments for three function implementations

PATCH Applied SF Markus Elfring 3 participants 7 messages Sep 27, 2017 – Nov 14, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Ux500 clock: Adjustments for three function implementations

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 20:40:20 +0200

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

Markus Elfring (2):
Delete an error message for a failed memory allocation in three functions Improve a size determination in three functions

 drivers/clk/ux500/clk-prcc.c    | 6 ++----
 drivers/clk/ux500/clk-prcmu.c   | 6 ++----
 drivers/clk/ux500/clk-sysctrl.c | 6 ++----
 3 files changed, 6 insertions(+), 12 deletions(-)
Signature · 1 line
2.14.2
#1 lore raw

PATCH 1/2 clk/ux500: Delete an error message for a failed memory allocation in three functions

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 20:23:58 +0200

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

---
 drivers/clk/ux500/clk-prcc.c    | 4 +---
 drivers/clk/ux500/clk-prcmu.c   | 4 +---
 drivers/clk/ux500/clk-sysctrl.c | 4 +---
 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/clk/ux500/clk-prcc.c +1 -3
index f50592775c9d..5ca07e6d1f64 100644
@@ -108,10 +108,8 @@ static struct clk *clk_reg_prcc(const char *name,
 	}
 
 	clk = kzalloc(sizeof(struct clk_prcc), GFP_KERNEL);
-	if (!clk) {
-		pr_err("clk_prcc: %s could not allocate clk\n", __func__);
+	if (!clk)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	clk->base = ioremap(phy_base, SZ_4K);
 	if (!clk->base)
drivers/clk/ux500/clk-prcmu.c +1 -3
index 6e3e16b2e5ca..c137934f23ab 100644
@@ -259,10 +259,8 @@ static struct clk *clk_reg_prcmu(const char *name,
 	}
 
 	clk = kzalloc(sizeof(struct clk_prcmu), GFP_KERNEL);
-	if (!clk) {
-		pr_err("clk_prcmu: %s could not allocate clk\n", __func__);
+	if (!clk)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	clk->cg_sel = cg_sel;
 	clk->is_prepared = 1;
drivers/clk/ux500/clk-sysctrl.c +1 -3
index 8a4e93ce1e42..e0a834c08a04 100644
@@ -140,10 +140,8 @@ static struct clk *clk_reg_sysctrl(struct device *dev,
 	}
 
 	clk = devm_kzalloc(dev, sizeof(struct clk_sysctrl), GFP_KERNEL);
-	if (!clk) {
-		dev_err(dev, "clk_sysctrl: could not allocate clk\n");
+	if (!clk)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	/* set main clock registers */
 	clk->reg_sel[0] = reg_sel[0];
Signature · 1 line
2.14.2
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions

Quoted 8 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 20:23:58 +0200

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Quoted 62 lines
---
 drivers/clk/ux500/clk-prcc.c    | 4 +---
 drivers/clk/ux500/clk-prcmu.c   | 4 +---
 drivers/clk/ux500/clk-sysctrl.c | 4 +---
 3 files changed, 3 insertions(+), 9 deletions(-)
drivers/clk/ux500/clk-prcc.c +1 -3
index f50592775c9d..5ca07e6d1f64 100644
@@ -108,10 +108,8 @@ static struct clk *clk_reg_prcc(const char *name,
        }
 
        clk = kzalloc(sizeof(struct clk_prcc), GFP_KERNEL);
-       if (!clk) {
-               pr_err("clk_prcc: %s could not allocate clk\n", __func__);
+       if (!clk)
                return ERR_PTR(-ENOMEM);
-       }
 
        clk->base = ioremap(phy_base, SZ_4K);
        if (!clk->base)
drivers/clk/ux500/clk-prcmu.c +1 -3
index 6e3e16b2e5ca..c137934f23ab 100644
@@ -259,10 +259,8 @@ static struct clk *clk_reg_prcmu(const char *name,
        }
 
        clk = kzalloc(sizeof(struct clk_prcmu), GFP_KERNEL);
-       if (!clk) {
-               pr_err("clk_prcmu: %s could not allocate clk\n", __func__);
+       if (!clk)
                return ERR_PTR(-ENOMEM);
-       }
 
        clk->cg_sel = cg_sel;
        clk->is_prepared = 1;
drivers/clk/ux500/clk-sysctrl.c +1 -4
index 8a4e93ce1e42..e0a834c08a04 100644
@@ -140,10 +140,8 @@ static struct clk *clk_reg_sysctrl(struct device *dev,
        }
 
        clk = devm_kzalloc(dev, sizeof(struct clk_sysctrl), GFP_KERNEL);
-       if (!clk) {
-               dev_err(dev, "clk_sysctrl: could not allocate clk\n");
+       if (!clk)
                return ERR_PTR(-ENOMEM);
-       }
 
        /* set main clock registers */
        clk->reg_sel[0] = reg_sel[0];
--

2.14.2

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Applied
#3 lore raw

Re: [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions

In reply to SF Markus Elfring
Quoted 9 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 20:23:58 +0200

Omit extra messages for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw

PATCH 2/2 clk/ux500: Improve a size determination in three functions

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 20:30:53 +0200

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.

---
 drivers/clk/ux500/clk-prcc.c    | 2 +-
 drivers/clk/ux500/clk-prcmu.c   | 2 +-
 drivers/clk/ux500/clk-sysctrl.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/ux500/clk-prcc.c +1 -1
index 5ca07e6d1f64..7cfb59c9136d 100644
@@ -107,7 +107,7 @@ static struct clk *clk_reg_prcc(const char *name,
 		return ERR_PTR(-EINVAL);
 	}
 
-	clk = kzalloc(sizeof(struct clk_prcc), GFP_KERNEL);
+	clk = kzalloc(sizeof(*clk), GFP_KERNEL);
 	if (!clk)
 		return ERR_PTR(-ENOMEM);
 
drivers/clk/ux500/clk-prcmu.c +1 -1
index c137934f23ab..9d1f2d4550ad 100644
@@ -258,7 +258,7 @@ static struct clk *clk_reg_prcmu(const char *name,
 		return ERR_PTR(-EINVAL);
 	}
 
-	clk = kzalloc(sizeof(struct clk_prcmu), GFP_KERNEL);
+	clk = kzalloc(sizeof(*clk), GFP_KERNEL);
 	if (!clk)
 		return ERR_PTR(-ENOMEM);
 
drivers/clk/ux500/clk-sysctrl.c +1 -1
index e0a834c08a04..7c0403b733ae 100644
@@ -139,7 +139,7 @@ static struct clk *clk_reg_sysctrl(struct device *dev,
 		return ERR_PTR(-EINVAL);
 	}
 
-	clk = devm_kzalloc(dev, sizeof(struct clk_sysctrl), GFP_KERNEL);
+	clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL);
 	if (!clk)
 		return ERR_PTR(-ENOMEM);
 
Signature · 1 line
2.14.2
Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] clk/ux500: Improve a size determination in three functions

Quoted 10 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 20:30:53 +0200

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.

Quoted 53 lines
---
 drivers/clk/ux500/clk-prcc.c    | 2 +-
 drivers/clk/ux500/clk-prcmu.c   | 2 +-
 drivers/clk/ux500/clk-sysctrl.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/clk/ux500/clk-prcc.c +1 -1
index 5ca07e6d1f64..7cfb59c9136d 100644
@@ -107,7 +107,7 @@ static struct clk *clk_reg_prcc(const char *name,
                return ERR_PTR(-EINVAL);
        }
 
-       clk = kzalloc(sizeof(struct clk_prcc), GFP_KERNEL);
+       clk = kzalloc(sizeof(*clk), GFP_KERNEL);
        if (!clk)
                return ERR_PTR(-ENOMEM);
 
drivers/clk/ux500/clk-prcmu.c +1 -1
index c137934f23ab..9d1f2d4550ad 100644
@@ -258,7 +258,7 @@ static struct clk *clk_reg_prcmu(const char *name,
                return ERR_PTR(-EINVAL);
        }
 
-       clk = kzalloc(sizeof(struct clk_prcmu), GFP_KERNEL);
+       clk = kzalloc(sizeof(*clk), GFP_KERNEL);
        if (!clk)
                return ERR_PTR(-ENOMEM);
 
drivers/clk/ux500/clk-sysctrl.c +1 -2
index e0a834c08a04..7c0403b733ae 100644
@@ -139,7 +139,7 @@ static struct clk *clk_reg_sysctrl(struct device *dev,
                return ERR_PTR(-EINVAL);
        }
 
-       clk = devm_kzalloc(dev, sizeof(struct clk_sysctrl), GFP_KERNEL);
+       clk = devm_kzalloc(dev, sizeof(*clk), GFP_KERNEL);
        if (!clk)
                return ERR_PTR(-ENOMEM);
 
--

2.14.2

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Applied
#6 lore raw

Re: [PATCH 2/2] clk/ux500: Improve a size determination in three functions

In reply to SF Markus Elfring
Quoted 11 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 20:30:53 +0200

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.

---

Applied to clk-next

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project