2017-09-27 19:39:00

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 0/2] versatile clock: Adjustments for icst_clk_setup()

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 21:34:43 +0200

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

Markus Elfring (2):
Delete two error messages for a failed memory allocation
Improve a size determination

drivers/clk/versatile/clk-icst.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

--
2.14.2


2017-09-27 19:39:56

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 1/2] clk/versatile: Delete two error messages for a failed memory allocation in icst_clk_setup()

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

Omit extra messages for a memory allocation failure in this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/clk/versatile/clk-icst.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index 09fbe66f1f11..20ab4ceffb28 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -360,15 +360,12 @@ static struct clk *icst_clk_setup(struct device *dev,
struct icst_params *pclone;

icst = kzalloc(sizeof(struct clk_icst), GFP_KERNEL);
- if (!icst) {
- pr_err("could not allocate ICST clock!\n");
+ if (!icst)
return ERR_PTR(-ENOMEM);
- }

pclone = kmemdup(desc->params, sizeof(*pclone), GFP_KERNEL);
if (!pclone) {
kfree(icst);
- pr_err("could not clone ICST params\n");
return ERR_PTR(-ENOMEM);
}

--
2.14.2

2017-09-27 19:41:00

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 2/2] clk/versatile: Improve a size determination in icst_clk_setup()

From: Markus Elfring <[email protected]>
Date: Wed, 27 Sep 2017 21:24:43 +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.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/clk/versatile/clk-icst.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c
index 20ab4ceffb28..dafe7a45875d 100644
--- a/drivers/clk/versatile/clk-icst.c
+++ b/drivers/clk/versatile/clk-icst.c
@@ -359,7 +359,7 @@ static struct clk *icst_clk_setup(struct device *dev,
struct clk_init_data init;
struct icst_params *pclone;

- icst = kzalloc(sizeof(struct clk_icst), GFP_KERNEL);
+ icst = kzalloc(sizeof(*icst), GFP_KERNEL);
if (!icst)
return ERR_PTR(-ENOMEM);

--
2.14.2

2017-11-14 02:02:30

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 2/2] clk/versatile: Improve a size determination in icst_clk_setup()

On 09/27, SF Markus Elfring wrote:
> From: Markus Elfring <[email protected]>
> Date: Wed, 27 Sep 2017 21:24:43 +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.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---

Applied to clk-next

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

From 1580269505727661844@xxx Tue Oct 03 20:27:20 +0000 2017
X-GM-THRID: 1579723043771134798
X-Gmail-Labels: Inbox,Category Forums

2017-10-03 20:27:21

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 2/2] clk/versatile: Improve a size determination in icst_clk_setup()

On Wed, Sep 27, 2017 at 9:40 PM, SF Markus Elfring
<[email protected]> wrote:

> From: Markus Elfring <[email protected]>
> Date: Wed, 27 Sep 2017 21:24:43 +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.
>
> Signed-off-by: Markus Elfring <[email protected]>

Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

From 1579723043771134798@xxx Wed Sep 27 19:41:33 +0000 2017
X-GM-THRID: 1579723043771134798
X-Gmail-Labels: Inbox,Category Forums

2017-11-14 02:02:22

by Stephen Boyd

[permalink] [raw]
Subject: Re: [PATCH 1/2] clk/versatile: Delete two error messages for a failed memory allocation in icst_clk_setup()

On 09/27, SF Markus Elfring wrote:
> From: Markus Elfring <[email protected]>
> Date: Wed, 27 Sep 2017 21:21:23 +0200
>
> Omit extra messages for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <[email protected]>
> ---

Applied to clk-next

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

From 1580269450945689093@xxx Tue Oct 03 20:26:28 +0000 2017
X-GM-THRID: 1579723061701809651
X-Gmail-Labels: Inbox,Category Forums

2017-10-03 20:26:28

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 1/2] clk/versatile: Delete two error messages for a failed memory allocation in icst_clk_setup()

On Wed, Sep 27, 2017 at 9:39 PM, SF Markus Elfring
<[email protected]> wrote:

> From: Markus Elfring <[email protected]>
> Date: Wed, 27 Sep 2017 21:21:23 +0200
>
> Omit extra messages for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <[email protected]>

Acked-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

From 1579723061701809651@xxx Wed Sep 27 19:41:50 +0000 2017
X-GM-THRID: 1579723061701809651
X-Gmail-Labels: Inbox,Category Forums