hwspinlock: sprd: Use struct_size() helper in devm_kzalloc()
[linux-2.6-microblaze.git] / drivers / hwspinlock / sprd_hwspinlock.c
index d221fc9..22e2ffb 100644 (file)
@@ -93,8 +93,7 @@ static int sprd_hwspinlock_probe(struct platform_device *pdev)
                return -ENODEV;
 
        sprd_hwlock = devm_kzalloc(&pdev->dev,
-                                  sizeof(struct sprd_hwspinlock_dev) +
-                                  SPRD_HWLOCKS_NUM * sizeof(*lock),
+                                  struct_size(sprd_hwlock, bank.lock, SPRD_HWLOCKS_NUM),
                                   GFP_KERNEL);
        if (!sprd_hwlock)
                return -ENOMEM;