linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Ux500 clock: Adjustments for three function implementations
@ 2017-09-27 18:45 SF Markus Elfring
  2017-09-27 18:46 ` [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
  2017-09-27 18:47 ` [PATCH 2/2] clk/ux500: Improve a size determination " SF Markus Elfring
  0 siblings, 2 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-09-27 18:45 UTC (permalink / raw)
  To: linux-arm-kernel

From: Markus Elfring <elfring@users.sourceforge.net>
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(-)

-- 
2.14.2

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

* [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions
  2017-09-27 18:45 [PATCH 0/2] Ux500 clock: Adjustments for three function implementations SF Markus Elfring
@ 2017-09-27 18:46 ` SF Markus Elfring
  2017-09-28 16:03   ` Ulf Hansson
  2017-11-14  1:59   ` Stephen Boyd
  2017-09-27 18:47 ` [PATCH 2/2] clk/ux500: Improve a size determination " SF Markus Elfring
  1 sibling, 2 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-09-27 18:46 UTC (permalink / raw)
  To: linux-arm-kernel

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 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(-)

diff --git a/drivers/clk/ux500/clk-prcc.c b/drivers/clk/ux500/clk-prcc.c
index f50592775c9d..5ca07e6d1f64 100644
--- a/drivers/clk/ux500/clk-prcc.c
+++ b/drivers/clk/ux500/clk-prcc.c
@@ -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)
diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c
index 6e3e16b2e5ca..c137934f23ab 100644
--- a/drivers/clk/ux500/clk-prcmu.c
+++ b/drivers/clk/ux500/clk-prcmu.c
@@ -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;
diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
index 8a4e93ce1e42..e0a834c08a04 100644
--- a/drivers/clk/ux500/clk-sysctrl.c
+++ b/drivers/clk/ux500/clk-sysctrl.c
@@ -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

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

* [PATCH 2/2] clk/ux500: Improve a size determination in three functions
  2017-09-27 18:45 [PATCH 0/2] Ux500 clock: Adjustments for three function implementations SF Markus Elfring
  2017-09-27 18:46 ` [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
@ 2017-09-27 18:47 ` SF Markus Elfring
  2017-09-28 16:04   ` Ulf Hansson
  2017-11-14  1:59   ` Stephen Boyd
  1 sibling, 2 replies; 7+ messages in thread
From: SF Markus Elfring @ 2017-09-27 18:47 UTC (permalink / raw)
  To: linux-arm-kernel

From: Markus Elfring <elfring@users.sourceforge.net>
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.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 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(-)

diff --git a/drivers/clk/ux500/clk-prcc.c b/drivers/clk/ux500/clk-prcc.c
index 5ca07e6d1f64..7cfb59c9136d 100644
--- a/drivers/clk/ux500/clk-prcc.c
+++ b/drivers/clk/ux500/clk-prcc.c
@@ -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);
 
diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c
index c137934f23ab..9d1f2d4550ad 100644
--- a/drivers/clk/ux500/clk-prcmu.c
+++ b/drivers/clk/ux500/clk-prcmu.c
@@ -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);
 
diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
index e0a834c08a04..7c0403b733ae 100644
--- a/drivers/clk/ux500/clk-sysctrl.c
+++ b/drivers/clk/ux500/clk-sysctrl.c
@@ -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

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

* [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions
  2017-09-27 18:46 ` [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
@ 2017-09-28 16:03   ` Ulf Hansson
  2017-11-14  1:59   ` Stephen Boyd
  1 sibling, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2017-09-28 16:03 UTC (permalink / raw)
  To: linux-arm-kernel

On 27 September 2017 at 20:46, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
>  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(-)
>
> diff --git a/drivers/clk/ux500/clk-prcc.c b/drivers/clk/ux500/clk-prcc.c
> index f50592775c9d..5ca07e6d1f64 100644
> --- a/drivers/clk/ux500/clk-prcc.c
> +++ b/drivers/clk/ux500/clk-prcc.c
> @@ -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)
> diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c
> index 6e3e16b2e5ca..c137934f23ab 100644
> --- a/drivers/clk/ux500/clk-prcmu.c
> +++ b/drivers/clk/ux500/clk-prcmu.c
> @@ -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;
> diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
> index 8a4e93ce1e42..e0a834c08a04 100644
> --- a/drivers/clk/ux500/clk-sysctrl.c
> +++ b/drivers/clk/ux500/clk-sysctrl.c
> @@ -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
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] clk/ux500: Improve a size determination in three functions
  2017-09-27 18:47 ` [PATCH 2/2] clk/ux500: Improve a size determination " SF Markus Elfring
@ 2017-09-28 16:04   ` Ulf Hansson
  2017-11-14  1:59   ` Stephen Boyd
  1 sibling, 0 replies; 7+ messages in thread
From: Ulf Hansson @ 2017-09-28 16:04 UTC (permalink / raw)
  To: linux-arm-kernel

On 27 September 2017 at 20:47, SF Markus Elfring
<elfring@users.sourceforge.net> wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---
>  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(-)
>
> diff --git a/drivers/clk/ux500/clk-prcc.c b/drivers/clk/ux500/clk-prcc.c
> index 5ca07e6d1f64..7cfb59c9136d 100644
> --- a/drivers/clk/ux500/clk-prcc.c
> +++ b/drivers/clk/ux500/clk-prcc.c
> @@ -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);
>
> diff --git a/drivers/clk/ux500/clk-prcmu.c b/drivers/clk/ux500/clk-prcmu.c
> index c137934f23ab..9d1f2d4550ad 100644
> --- a/drivers/clk/ux500/clk-prcmu.c
> +++ b/drivers/clk/ux500/clk-prcmu.c
> @@ -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);
>
> diff --git a/drivers/clk/ux500/clk-sysctrl.c b/drivers/clk/ux500/clk-sysctrl.c
> index e0a834c08a04..7c0403b733ae 100644
> --- a/drivers/clk/ux500/clk-sysctrl.c
> +++ b/drivers/clk/ux500/clk-sysctrl.c
> @@ -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
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH 2/2] clk/ux500: Improve a size determination in three functions
  2017-09-27 18:47 ` [PATCH 2/2] clk/ux500: Improve a size determination " SF Markus Elfring
  2017-09-28 16:04   ` Ulf Hansson
@ 2017-11-14  1:59   ` Stephen Boyd
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2017-11-14  1:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/27, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
> 
> 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] 7+ messages in thread

* [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions
  2017-09-27 18:46 ` [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
  2017-09-28 16:03   ` Ulf Hansson
@ 2017-11-14  1:59   ` Stephen Boyd
  1 sibling, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2017-11-14  1:59 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/27, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
> 
> 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] 7+ messages in thread

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

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-27 18:45 [PATCH 0/2] Ux500 clock: Adjustments for three function implementations SF Markus Elfring
2017-09-27 18:46 ` [PATCH 1/2] clk/ux500: Delete an error message for a failed memory allocation in three functions SF Markus Elfring
2017-09-28 16:03   ` Ulf Hansson
2017-11-14  1:59   ` Stephen Boyd
2017-09-27 18:47 ` [PATCH 2/2] clk/ux500: Improve a size determination " SF Markus Elfring
2017-09-28 16:04   ` Ulf Hansson
2017-11-14  1:59   ` 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).