diff mbox series

[v2,2/2] i2c: designware-pci: Use standard pattern for memory allocation

Message ID 20220929094215.76236-2-andriy.shevchenko@linux.intel.com
State Accepted
Commit fe682780d5cdf7b3932c6a1c669db8fc344f7e17
Headers show
Series [v2,1/2] i2c: designware-pci: Group AMD NAVI quirk parts together | expand

Commit Message

Andy Shevchenko Sept. 29, 2022, 9:42 a.m. UTC
The pattern
	foo = kmalloc(sizeof(*foo), GFP_KERNEL);
has an advantage when foo type is changed. Since we are planning a such,
better to be prepared by using standard pattern for memory allocation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
v2: added tag (Jarkko)
 drivers/i2c/busses/i2c-designware-pcidrv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Wolfram Sang Oct. 1, 2022, 10:43 p.m. UTC | #1
On Thu, Sep 29, 2022 at 12:42:15PM +0300, Andy Shevchenko wrote:
> The pattern
> 	foo = kmalloc(sizeof(*foo), GFP_KERNEL);
> has an advantage when foo type is changed. Since we are planning a such,
> better to be prepared by using standard pattern for memory allocation.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 6e8a9d26563a..e499f96506c5 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -263,7 +263,7 @@  static int i2c_dw_pci_probe(struct pci_dev *pdev,
 		return dev_err_probe(&pdev->dev, r,
 				     "I/O memory remapping failed\n");
 
-	dev = devm_kzalloc(&pdev->dev, sizeof(struct dw_i2c_dev), GFP_KERNEL);
+	dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
 	if (!dev)
 		return -ENOMEM;