diff options
author | Andrew Davis <afd@ti.com> | 2023-05-15 19:50:42 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2023-06-07 11:28:48 +0200 |
commit | 1ebafd5f5caaece1d25556cfb3a8f7fcb7629550 (patch) | |
tree | 68dfff91979591cb7b1179298b0932cdeda38e93 /drivers/i2c | |
parent | i2c: rzv2m: Disable the operation of unit in case of error (diff) | |
download | linux-1ebafd5f5caaece1d25556cfb3a8f7fcb7629550.tar.xz linux-1ebafd5f5caaece1d25556cfb3a8f7fcb7629550.zip |
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 <afd@ti.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-davinci.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index b77f9288c0de..78bd2a180e6d 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -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); |