Commit ae72c991 authored by Markus Elfring's avatar Markus Elfring Committed by Samuel Ortiz

NFC: digital: Improve a size determination in four functions

Replace the specification of four 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.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent e1038535
...@@ -240,7 +240,7 @@ int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type, ...@@ -240,7 +240,7 @@ int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type,
{ {
struct digital_cmd *cmd; struct digital_cmd *cmd;
cmd = kzalloc(sizeof(struct digital_cmd), GFP_KERNEL); cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd) if (!cmd)
return -ENOMEM; return -ENOMEM;
...@@ -287,7 +287,7 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech) ...@@ -287,7 +287,7 @@ static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech)
{ {
struct digital_tg_mdaa_params *params; struct digital_tg_mdaa_params *params;
params = kzalloc(sizeof(struct digital_tg_mdaa_params), GFP_KERNEL); params = kzalloc(sizeof(*params), GFP_KERNEL);
if (!params) if (!params)
return -ENOMEM; return -ENOMEM;
...@@ -706,7 +706,7 @@ static int digital_in_send(struct nfc_dev *nfc_dev, struct nfc_target *target, ...@@ -706,7 +706,7 @@ static int digital_in_send(struct nfc_dev *nfc_dev, struct nfc_target *target,
struct digital_data_exch *data_exch; struct digital_data_exch *data_exch;
int rc; int rc;
data_exch = kzalloc(sizeof(struct digital_data_exch), GFP_KERNEL); data_exch = kzalloc(sizeof(*data_exch), GFP_KERNEL);
if (!data_exch) { if (!data_exch) {
pr_err("Failed to allocate data_exch struct\n"); pr_err("Failed to allocate data_exch struct\n");
return -ENOMEM; return -ENOMEM;
...@@ -764,7 +764,7 @@ struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops, ...@@ -764,7 +764,7 @@ struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops,
!ops->switch_rf || (ops->tg_listen_md && !ops->tg_get_rf_tech)) !ops->switch_rf || (ops->tg_listen_md && !ops->tg_get_rf_tech))
return NULL; return NULL;
ddev = kzalloc(sizeof(struct nfc_digital_dev), GFP_KERNEL); ddev = kzalloc(sizeof(*ddev), GFP_KERNEL);
if (!ddev) if (!ddev)
return NULL; return NULL;
......
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