Skip to contentSkip to conversation

clk-mux: Adjustments for clk_hw_register_mux_table()

PATCH Applied SF Markus Elfring 2 participants 5 messages Sep 26, 2017 – Nov 14, 2017

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

cover clk-mux: Adjustments for clk_hw_register_mux_table()

From: Markus Elfring <[email protected]>
Date: Tue, 26 Sep 2017 18:16:12 +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 Improve a size determination

 drivers/clk/clk-mux.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/2 clk-mux: Delete an error message for a failed memory allocation in clk_hw_register_mux_table()

From: Markus Elfring <[email protected]>
Date: Tue, 26 Sep 2017 17:23:04 +0200

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

This issue was detected by using the Coccinelle software.

---
 drivers/clk/clk-mux.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/clk/clk-mux.c +1 -3
index 16a3d5717f4e..1746dbf2f7ea 100644
@@ -135,10 +135,8 @@ struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name,
 
 	/* allocate the mux */
 	mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL);
-	if (!mux) {
-		pr_err("%s: could not allocate mux clk\n", __func__);
+	if (!mux)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	init.name = name;
 	if (clk_mux_flags & CLK_MUX_READ_ONLY)
Signature · 1 line
2.14.1
Applied
#2 lore raw

Re: [PATCH 1/2] clk-mux: Delete an error message for a failed memory allocation in clk_hw_register_mux_table()

Quoted 9 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 26 Sep 2017 17:23:04 +0200

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

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
#3 lore raw

PATCH 2/2 clk-mux: Improve a size determination in clk_hw_register_mux_table()

In reply to SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 26 Sep 2017 17:30:06 +0200

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.

---
 drivers/clk/clk-mux.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-mux.c +1 -1
index 1746dbf2f7ea..39cabe157163 100644
@@ -134,7 +134,7 @@ struct clk_hw *clk_hw_register_mux_table(struct device *dev, const char *name,
 	}
 
 	/* allocate the mux */
-	mux = kzalloc(sizeof(struct clk_mux), GFP_KERNEL);
+	mux = kzalloc(sizeof(*mux), GFP_KERNEL);
 	if (!mux)
 		return ERR_PTR(-ENOMEM);
 
Signature · 1 line
2.14.1
Applied
#4 lore raw

Re: [PATCH 2/2] clk-mux: Improve a size determination in clk_hw_register_mux_table()

Quoted 11 lines · SF Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 26 Sep 2017 17:30:06 +0200

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.

---

Applied to clk-next

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