* [PATCH 0/2] misc/apds9802als: Adjustments for apds9802als_probe()
@ 2018-01-07 21:01 SF Markus Elfring
2018-01-07 21:02 ` [PATCH 1/2] misc/apds9802als: Delete an error message for a failed memory allocation in apds9802als_probe() SF Markus Elfring
2018-01-07 21:03 ` [PATCH 2/2] misc/apds9802als: Improve a size determination " SF Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-01-07 21:01 UTC (permalink / raw)
To: kernel-janitors, Arnd Bergmann, Greg Kroah-Hartman; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 7 Jan 2018 21:58:42 +0100
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/misc/apds9802als.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
--
2.15.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] misc/apds9802als: Delete an error message for a failed memory allocation in apds9802als_probe()
2018-01-07 21:01 [PATCH 0/2] misc/apds9802als: Adjustments for apds9802als_probe() SF Markus Elfring
@ 2018-01-07 21:02 ` SF Markus Elfring
2018-01-07 21:03 ` [PATCH 2/2] misc/apds9802als: Improve a size determination " SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-01-07 21:02 UTC (permalink / raw)
To: kernel-janitors, Arnd Bergmann, Greg Kroah-Hartman; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 7 Jan 2018 21:42:07 +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 <elfring@users.sourceforge.net>
---
drivers/misc/apds9802als.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c
index d8ac036f01ab..fa548796c92e 100644
--- a/drivers/misc/apds9802als.c
+++ b/drivers/misc/apds9802als.c
@@ -231,10 +231,9 @@ static int apds9802als_probe(struct i2c_client *client,
struct als_data *data;
data = kzalloc(sizeof(struct als_data), GFP_KERNEL);
- if (data == NULL) {
- dev_err(&client->dev, "Memory allocation failed\n");
+ if (!data)
return -ENOMEM;
- }
+
i2c_set_clientdata(client, data);
res = sysfs_create_group(&client->dev.kobj, &m_als_gr);
if (res) {
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] misc/apds9802als: Improve a size determination in apds9802als_probe()
2018-01-07 21:01 [PATCH 0/2] misc/apds9802als: Adjustments for apds9802als_probe() SF Markus Elfring
2018-01-07 21:02 ` [PATCH 1/2] misc/apds9802als: Delete an error message for a failed memory allocation in apds9802als_probe() SF Markus Elfring
@ 2018-01-07 21:03 ` SF Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: SF Markus Elfring @ 2018-01-07 21:03 UTC (permalink / raw)
To: kernel-janitors, Arnd Bergmann, Greg Kroah-Hartman; +Cc: LKML
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sun, 7 Jan 2018 21:48:50 +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 <elfring@users.sourceforge.net>
---
drivers/misc/apds9802als.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/misc/apds9802als.c b/drivers/misc/apds9802als.c
index fa548796c92e..acf467666737 100644
--- a/drivers/misc/apds9802als.c
+++ b/drivers/misc/apds9802als.c
@@ -228,9 +228,8 @@ static int apds9802als_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
int res;
- struct als_data *data;
+ struct als_data *data = kzalloc(sizeof(*data), GFP_KERNEL);
- data = kzalloc(sizeof(struct als_data), GFP_KERNEL);
if (!data)
return -ENOMEM;
--
2.15.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-07 21:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-07 21:01 [PATCH 0/2] misc/apds9802als: Adjustments for apds9802als_probe() SF Markus Elfring
2018-01-07 21:02 ` [PATCH 1/2] misc/apds9802als: Delete an error message for a failed memory allocation in apds9802als_probe() SF Markus Elfring
2018-01-07 21:03 ` [PATCH 2/2] misc/apds9802als: Improve a size determination " SF Markus Elfring
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).