linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] X-Gene clock: Adjustments for seven function implementations
@ 2017-09-26 19:40 SF Markus Elfring
  2017-09-26 19:41 ` [PATCH 1/2] clk-xgene: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
  2017-09-26 19:42 ` [PATCH 2/2] clk-xgene: Adjust six checks for null pointers SF Markus Elfring
  0 siblings, 2 replies; 5+ messages in thread
From: SF Markus Elfring @ 2017-09-26 19:40 UTC (permalink / raw)
  To: linux-clk, Loc Ho, Michael Turquette, Stephen Boyd; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 26 Sep 2017 21:36:54 +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 two functions
  Adjust six checks for null pointers

 drivers/clk/clk-xgene.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

-- 
2.14.1

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

* [PATCH 1/2] clk-xgene: Delete an error message for a failed memory allocation in two functions
  2017-09-26 19:40 [PATCH 0/2] X-Gene clock: Adjustments for seven function implementations SF Markus Elfring
@ 2017-09-26 19:41 ` SF Markus Elfring
  2017-11-14  1:58   ` Stephen Boyd
  2017-09-26 19:42 ` [PATCH 2/2] clk-xgene: Adjust six checks for null pointers SF Markus Elfring
  1 sibling, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2017-09-26 19:41 UTC (permalink / raw)
  To: linux-clk, Loc Ho, Michael Turquette, Stephen Boyd; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 26 Sep 2017 21:19:19 +0200

Omit extra messages 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/clk/clk-xgene.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c
index 4c75821a3933..3cc84a65f686 100644
--- a/drivers/clk/clk-xgene.c
+++ b/drivers/clk/clk-xgene.c
@@ -146,10 +146,8 @@ static struct clk *xgene_register_clk_pll(struct device *dev,
 
 	/* allocate the APM clock structure */
 	apmclk = kzalloc(sizeof(*apmclk), GFP_KERNEL);
-	if (!apmclk) {
-		pr_err("%s: could not allocate APM clk\n", __func__);
+	if (!apmclk)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	init.name = name;
 	init.ops = &xgene_clk_pll_ops;
@@ -650,10 +648,8 @@ static struct clk *xgene_register_clk(struct device *dev,
 
 	/* allocate the APM clock structure */
 	apmclk = kzalloc(sizeof(*apmclk), GFP_KERNEL);
-	if (!apmclk) {
-		pr_err("%s: could not allocate APM clk\n", __func__);
+	if (!apmclk)
 		return ERR_PTR(-ENOMEM);
-	}
 
 	init.name = name;
 	init.ops = &xgene_clk_ops;
-- 
2.14.1

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

* [PATCH 2/2] clk-xgene: Adjust six checks for null pointers
  2017-09-26 19:40 [PATCH 0/2] X-Gene clock: Adjustments for seven function implementations SF Markus Elfring
  2017-09-26 19:41 ` [PATCH 1/2] clk-xgene: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
@ 2017-09-26 19:42 ` SF Markus Elfring
  2017-11-14  1:58   ` Stephen Boyd
  1 sibling, 1 reply; 5+ messages in thread
From: SF Markus Elfring @ 2017-09-26 19:42 UTC (permalink / raw)
  To: linux-clk, Loc Ho, Michael Turquette, Stephen Boyd; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 26 Sep 2017 21:27:52 +0200
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/clk/clk-xgene.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/clk/clk-xgene.c b/drivers/clk/clk-xgene.c
index 3cc84a65f686..531b030d4d4e 100644
--- a/drivers/clk/clk-xgene.c
+++ b/drivers/clk/clk-xgene.c
@@ -189,7 +189,7 @@ static void xgene_pllclk_init(struct device_node *np, enum xgene_pll_type pll_ty
 	int version = xgene_pllclk_version(np);
 
 	reg = of_iomap(np, 0);
-	if (reg == NULL) {
+	if (!reg) {
 		pr_err("Unable to map CSR register for %pOF\n", np);
 		return;
 	}
@@ -465,7 +465,7 @@ static int xgene_clk_enable(struct clk_hw *hw)
 	if (pclk->lock)
 		spin_lock_irqsave(pclk->lock, flags);
 
-	if (pclk->param.csr_reg != NULL) {
+	if (pclk->param.csr_reg) {
 		pr_debug("%s clock enabled\n", clk_hw_get_name(hw));
 		/* First enable the clock */
 		data = xgene_clk_read(pclk->param.csr_reg +
@@ -505,7 +505,7 @@ static void xgene_clk_disable(struct clk_hw *hw)
 	if (pclk->lock)
 		spin_lock_irqsave(pclk->lock, flags);
 
-	if (pclk->param.csr_reg != NULL) {
+	if (pclk->param.csr_reg) {
 		pr_debug("%s clock disabled\n", clk_hw_get_name(hw));
 		/* First put the CSR in reset */
 		data = xgene_clk_read(pclk->param.csr_reg +
@@ -531,7 +531,7 @@ static int xgene_clk_is_enabled(struct clk_hw *hw)
 	struct xgene_clk *pclk = to_xgene_clk(hw);
 	u32 data = 0;
 
-	if (pclk->param.csr_reg != NULL) {
+	if (pclk->param.csr_reg) {
 		pr_debug("%s clock checking\n", clk_hw_get_name(hw));
 		data = xgene_clk_read(pclk->param.csr_reg +
 					pclk->param.reg_clk_offset);
@@ -540,7 +540,7 @@ static int xgene_clk_is_enabled(struct clk_hw *hw)
 							"disabled");
 	}
 
-	if (pclk->param.csr_reg == NULL)
+	if (!pclk->param.csr_reg)
 		return 1;
 	return data & pclk->param.reg_clk_mask ? 1 : 0;
 }
@@ -705,7 +705,7 @@ static void __init xgene_devclk_init(struct device_node *np)
 			break;
 		}
 		map_res = of_iomap(np, i);
-		if (map_res == NULL) {
+		if (!map_res) {
 			pr_err("Unable to map resource %d for %pOF\n", i, np);
 			goto err;
 		}
-- 
2.14.1

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

* Re: [PATCH 2/2] clk-xgene: Adjust six checks for null pointers
  2017-09-26 19:42 ` [PATCH 2/2] clk-xgene: Adjust six checks for null pointers SF Markus Elfring
@ 2017-11-14  1:58   ` Stephen Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2017-11-14  1:58 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-clk, Loc Ho, Michael Turquette, LKML, kernel-janitors

On 09/26, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 26 Sep 2017 21:27:52 +0200
> 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>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* Re: [PATCH 1/2] clk-xgene: Delete an error message for a failed memory allocation in two functions
  2017-09-26 19:41 ` [PATCH 1/2] clk-xgene: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
@ 2017-11-14  1:58   ` Stephen Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2017-11-14  1:58 UTC (permalink / raw)
  To: SF Markus Elfring
  Cc: linux-clk, Loc Ho, Michael Turquette, LKML, kernel-janitors

On 09/26, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 26 Sep 2017 21:19:19 +0200
> 
> Omit extra messages 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>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2017-11-14  1:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-26 19:40 [PATCH 0/2] X-Gene clock: Adjustments for seven function implementations SF Markus Elfring
2017-09-26 19:41 ` [PATCH 1/2] clk-xgene: Delete an error message for a failed memory allocation in two functions SF Markus Elfring
2017-11-14  1:58   ` Stephen Boyd
2017-09-26 19:42 ` [PATCH 2/2] clk-xgene: Adjust six checks for null pointers SF Markus Elfring
2017-11-14  1:58   ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).