i2c: davinci: Use struct name not type with devm_kzalloc()
authorAndrew Davis <afd@ti.com>
Mon, 15 May 2023 17:50:42 +0000 (12:50 -0500)
committerWolfram Sang <wsa@kernel.org>
Wed, 7 Jun 2023 09:28:48 +0000 (11:28 +0200)
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 <afd@ti.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-davinci.c

index b77f9288c0de6fd63fdb30e020e7d23e38f49f5f..78bd2a180e6d0c8473affcc2cb77251f050e09a0 100644 (file)
@@ -767,12 +767,9 @@ static int davinci_i2c_probe(struct platform_device *pdev)
        if (irq < 0)
                return dev_err_probe(&pdev->dev, irq, "can't get irq resource\n");
 
-       dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_i2c_dev),
-                       GFP_KERNEL);
-       if (!dev) {
-               dev_err(&pdev->dev, "Memory allocation failed\n");
+       dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
+       if (!dev)
                return -ENOMEM;
-       }
 
        init_completion(&dev->cmd_complete);