]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
[media] i2c: Improve a size determination
authorMarkus Elfring <elfring@users.sourceforge.net>
Sat, 2 Sep 2017 14:09:35 +0000 (11:09 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 4 Oct 2017 20:15:39 +0000 (17:15 -0300)
Replace the specification of a data structure by pointer dereferences
as the parameter for the operator "sizeof" to make size
determination a bit safer according to the Linux coding style convention.

This issue was detected by using the Coccinelle software.

[mchehab@s-opensource.com: merged similar patches]
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/i2c/ov2640.c
drivers/media/i2c/soc_camera/ov9640.c
drivers/media/i2c/soc_camera/ov9740.c

index c0d0c50f1d02d7cd808317d64d41834482fcb8e4..cc3882c1e10eed25158346859dffe1c1b2767c47 100644 (file)
@@ -1097,7 +1097,7 @@ static int ov2640_probe(struct i2c_client *client,
                return -EIO;
        }
 
-       priv = devm_kzalloc(&client->dev, sizeof(struct ov2640_priv), GFP_KERNEL);
+       priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
 
index 883500805aac45b1bf28a22ec12236cd53dcd2ab..c639489896883417cfe4179fe0568f7a27f6677a 100644 (file)
@@ -675,7 +675,7 @@ static int ov9640_probe(struct i2c_client *client,
                return -EINVAL;
        }
 
-       priv = devm_kzalloc(&client->dev, sizeof(struct ov9640_priv), GFP_KERNEL);
+       priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;
 
index f44f5da795f94a01f62eae4e9928e5dd18de60da..755de2289c395bba5a84baf25407cdb0352709ba 100644 (file)
@@ -935,7 +935,7 @@ static int ov9740_probe(struct i2c_client *client,
                return -EINVAL;
        }
 
-       priv = devm_kzalloc(&client->dev, sizeof(struct ov9740_priv), GFP_KERNEL);
+       priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
        if (!priv)
                return -ENOMEM;