Skip to content

Commit 1ebafd5

Browse files
glneowsakernel
authored andcommitted
i2c: davinci: Use struct name not type with devm_kzalloc()
This reduces chance of error if the type of "dev" changes. While here remove extra error print out, this is not usually done for memory allocation failures. Signed-off-by: Andrew Davis <[email protected]> Reviewed-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent c3cc5c5 commit 1ebafd5

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

drivers/i2c/busses/i2c-davinci.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -767,12 +767,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
767767
if (irq < 0)
768768
return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n");
769769

770-
dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev),
771-
GFP_KERNEL);
772-
if (!dev) {
773-
dev_err(&pdev->dev, "Memory allocation failed\n");
770+
dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
771+
if (!dev)
774772
return -ENOMEM;
775-
}
776773

777774
init_completion(&dev->cmd_complete);
778775

0 commit comments

Comments
 (0)