Skip to content

Commit 06e9895

Browse files
elfringwsakernel
authored andcommitted
i2c: Improve size determinations
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 <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 6b3b21a commit 06e9895

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/i2c/busses/i2c-nomadik.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
970970
struct i2c_vendor_data *vendor = id->data;
971971
u32 max_fifo_threshold = (vendor->fifodepth / 2) - 1;
972972

973-
dev = devm_kzalloc(&adev->dev, sizeof(struct nmk_i2c_dev), GFP_KERNEL);
973+
dev = devm_kzalloc(&adev->dev, sizeof(*dev), GFP_KERNEL);
974974
if (!dev) {
975975
ret = -ENOMEM;
976976
goto err_no_mem;

drivers/i2c/busses/i2c-sh7760.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ static int sh7760_i2c_probe(struct platform_device *pdev)
443443
goto out0;
444444
}
445445

446-
id = kzalloc(sizeof(struct cami2c), GFP_KERNEL);
446+
id = kzalloc(sizeof(*id), GFP_KERNEL);
447447
if (!id) {
448448
ret = -ENOMEM;
449449
goto out0;

0 commit comments

Comments
 (0)