2018-01-10 15:31:33

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 0/3] misc/TI-ST: Adjustments for three function implementations

From: Markus Elfring <[email protected]>
Date: Wed, 10 Jan 2018 16:26:36 +0100

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

Markus Elfring (3):
Delete an error message for a failed memory allocation in kim_probe()
Improve a size determination in kim_probe()
Delete an unnecessary return statement in two functions

drivers/misc/ti-st/st_kim.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

--
2.15.1


2018-01-10 15:32:42

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 1/3] misc/ti-st: Delete an error message for a failed memory allocation in kim_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 10 Jan 2018 16:04:52 +0100

Omit an extra message 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/misc/ti-st/st_kim.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index b77aacafc3fc..68ebdf466b17 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -736,10 +736,9 @@ static int kim_probe(struct platform_device *pdev)
}

kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC);
- if (!kim_gdata) {
- pr_err("no mem to allocate");
+ if (!kim_gdata)
return -ENOMEM;
- }
+
platform_set_drvdata(pdev, kim_gdata);

err = st_core_init(&kim_gdata->core_data);
--
2.15.1

2018-01-10 15:33:45

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 2/3] misc/ti-st: Improve a size determination in kim_probe()

From: Markus Elfring <[email protected]>
Date: Wed, 10 Jan 2018 16:10:45 +0100

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/misc/ti-st/st_kim.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 68ebdf466b17..948e3461d02e 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -735,7 +735,7 @@ static int kim_probe(struct platform_device *pdev)
st_kim_devices[0] = pdev;
}

- kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC);
+ kim_gdata = kzalloc(sizeof(*kim_gdata), GFP_ATOMIC);
if (!kim_gdata)
return -ENOMEM;

--
2.15.1

2018-01-10 15:34:51

by SF Markus Elfring

[permalink] [raw]
Subject: [PATCH 3/3] misc/ti-st: Delete an unnecessary return statement in two functions

From: Markus Elfring <[email protected]>
Date: Wed, 10 Jan 2018 16:16:55 +0100

The script "checkpatch.pl" pointed information out like the following.

WARNING: void function return statements are not generally useful

Thus remove such a statement in the affected functions.

Signed-off-by: Markus Elfring <[email protected]>
---
drivers/misc/ti-st/st_kim.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
index 948e3461d02e..e33eb4bcb608 100644
--- a/drivers/misc/ti-st/st_kim.c
+++ b/drivers/misc/ti-st/st_kim.c
@@ -206,7 +206,6 @@ static void kim_int_recv(struct kim_data_s *kim_gdata,
kim_gdata->rx_skb->cb[1] = 0;

}
- return;
}

static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name)
@@ -436,7 +435,6 @@ void st_kim_recv(void *disc_data, const unsigned char *data, long count)
* from other fw responses when data gathering is complete
*/
kim_int_recv(kim_gdata, data, count);
- return;
}

/* to signal completion of line discipline installation
--
2.15.1