Commit d1509c09 authored by Markus Elfring's avatar Markus Elfring Committed by Linus Torvalds

rapidio: improve a size determination in five functions

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.

Link: http://lkml.kernel.org/r/495f571c-fb4d-b1d5-a6e5-494f2c537a8d@users.sourceforge.netSigned-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Acked-by: default avatarAlexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e1d66d04
...@@ -110,9 +110,8 @@ EXPORT_SYMBOL(rio_query_mport); ...@@ -110,9 +110,8 @@ EXPORT_SYMBOL(rio_query_mport);
*/ */
struct rio_net *rio_alloc_net(struct rio_mport *mport) struct rio_net *rio_alloc_net(struct rio_mport *mport)
{ {
struct rio_net *net; struct rio_net *net = kzalloc(sizeof(*net), GFP_KERNEL);
net = kzalloc(sizeof(struct rio_net), GFP_KERNEL);
if (net) { if (net) {
INIT_LIST_HEAD(&net->node); INIT_LIST_HEAD(&net->node);
INIT_LIST_HEAD(&net->devices); INIT_LIST_HEAD(&net->devices);
...@@ -246,8 +245,7 @@ int rio_request_inb_mbox(struct rio_mport *mport, ...@@ -246,8 +245,7 @@ int rio_request_inb_mbox(struct rio_mport *mport,
if (!mport->ops->open_inb_mbox) if (!mport->ops->open_inb_mbox)
goto out; goto out;
res = kzalloc(sizeof(struct resource), GFP_KERNEL); res = kzalloc(sizeof(*res), GFP_KERNEL);
if (res) { if (res) {
rio_init_mbox_res(res, mbox, mbox); rio_init_mbox_res(res, mbox, mbox);
...@@ -329,8 +327,7 @@ int rio_request_outb_mbox(struct rio_mport *mport, ...@@ -329,8 +327,7 @@ int rio_request_outb_mbox(struct rio_mport *mport,
if (!mport->ops->open_outb_mbox) if (!mport->ops->open_outb_mbox)
goto out; goto out;
res = kzalloc(sizeof(struct resource), GFP_KERNEL); res = kzalloc(sizeof(*res), GFP_KERNEL);
if (res) { if (res) {
rio_init_mbox_res(res, mbox, mbox); rio_init_mbox_res(res, mbox, mbox);
...@@ -445,8 +442,7 @@ int rio_request_inb_dbell(struct rio_mport *mport, ...@@ -445,8 +442,7 @@ int rio_request_inb_dbell(struct rio_mport *mport,
u16 dst, u16 info)) u16 dst, u16 info))
{ {
int rc = 0; int rc = 0;
struct resource *res = kzalloc(sizeof(*res), GFP_KERNEL);
struct resource *res = kzalloc(sizeof(struct resource), GFP_KERNEL);
if (res) { if (res) {
rio_init_dbell_res(res, start, end); rio_init_dbell_res(res, start, end);
...@@ -568,9 +564,8 @@ int rio_add_mport_pw_handler(struct rio_mport *mport, void *context, ...@@ -568,9 +564,8 @@ int rio_add_mport_pw_handler(struct rio_mport *mport, void *context,
void *context, union rio_pw_msg *msg, int step)) void *context, union rio_pw_msg *msg, int step))
{ {
int rc = 0; int rc = 0;
struct rio_pwrite *pwrite; struct rio_pwrite *pwrite = kzalloc(sizeof(*pwrite), GFP_KERNEL);
pwrite = kzalloc(sizeof(struct rio_pwrite), GFP_KERNEL);
if (!pwrite) { if (!pwrite) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment