From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org, Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/2] misc/apds9802als: Improve a size determination in apds9802als_probe()
Date: Sun, 7 Jan 2018 22:03:56 +0100 [thread overview]
Message-ID: <a1fd0305-9f42-c172-3869-e2d0e1990011@users.sourceforge.net> (raw)
In-Reply-To: <cfd7cb73-7437-0d95-ef7a-8c8f6ce49e3d@users.sourceforge.net>
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
prev parent reply other threads:[~2018-01-07 21:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a1fd0305-9f42-c172-3869-e2d0e1990011@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome