staging: vt6656: Use variable instead of its type in sizeof(...)
Use sizeof(variable) instead of sizeof(type) in memory allocations to prevent problems if the variable type changes in the future. Signed-off-by: Simon Sandström <simon@nikanor.nu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
3781f88786
Коммит
f124a47857
|
@ -419,8 +419,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
for (ii = 0; ii < priv->num_tx_context; ii++) {
|
for (ii = 0; ii < priv->num_tx_context; ii++) {
|
||||||
tx_context = kmalloc(sizeof(struct vnt_usb_send_context),
|
tx_context = kmalloc(sizeof(*tx_context), GFP_KERNEL);
|
||||||
GFP_KERNEL);
|
|
||||||
if (!tx_context)
|
if (!tx_context)
|
||||||
goto free_tx;
|
goto free_tx;
|
||||||
|
|
||||||
|
@ -437,7 +436,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ii = 0; ii < priv->num_rcb; ii++) {
|
for (ii = 0; ii < priv->num_rcb; ii++) {
|
||||||
priv->rcb[ii] = kzalloc(sizeof(struct vnt_rcb), GFP_KERNEL);
|
priv->rcb[ii] = kzalloc(sizeof(*priv->rcb[ii]), GFP_KERNEL);
|
||||||
if (!priv->rcb[ii]) {
|
if (!priv->rcb[ii]) {
|
||||||
dev_err(&priv->usb->dev,
|
dev_err(&priv->usb->dev,
|
||||||
"failed to allocate rcb no %d\n", ii);
|
"failed to allocate rcb no %d\n", ii);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче