Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933887AbbGVJih (ORCPT ); Wed, 22 Jul 2015 05:38:37 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:32809 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933017AbbGVJif (ORCPT ); Wed, 22 Jul 2015 05:38:35 -0400 From: Vaibhav Hiremath To: linux-arm-kernel@lists.infradead.org Cc: Vaibhav Hiremath , Sangbeom Kim , Krzysztof Kozlowski , Michael Turquette , Stephen Boyd , linux-kernel@vger.kernel.org (open list:SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS), linux-samsung-soc@vger.kernel.org (open list:SAMSUNG MULTIFUNCTION PMIC DEVICE DRIVERS), linux-clk@vger.kernel.org (open list:COMMON CLK FRAMEWORK) Subject: [PATCH] clk: s2mps11: Use kcalloc instead of kzalloc for array allocation Date: Wed, 22 Jul 2015 15:04:53 +0530 Message-Id: <1437557693-29433-1-git-send-email-vaibhav.hiremath@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2619 Lines: 84 This patch cleans up the driver for, - Use devm_kcalloc varient instead of devm_kzalloc for array allocation. - clk_prepare/unprepare, remove "ret" variable as it is not required - use __exit for cleanup function As I am referring this driver as a reference for my 88pm800 clk driver, applying same changes here as well. Signed-off-by: Vaibhav Hiremath --- Since I do not have platform to test, it would be helpful if someone tests it for me. I have build tested it. drivers/clk/clk-s2mps11.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/clk/clk-s2mps11.c b/drivers/clk/clk-s2mps11.c index 9b13a30..e17c66a 100644 --- a/drivers/clk/clk-s2mps11.c +++ b/drivers/clk/clk-s2mps11.c @@ -58,21 +58,17 @@ static struct s2mps11_clk *to_s2mps11_clk(struct clk_hw *hw) static int s2mps11_clk_prepare(struct clk_hw *hw) { struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw); - int ret; - ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, + return regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg, s2mps11->mask, s2mps11->mask); - - return ret; } static void s2mps11_clk_unprepare(struct clk_hw *hw) { struct s2mps11_clk *s2mps11 = to_s2mps11_clk(hw); - int ret; - ret = regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg, + regmap_update_bits(s2mps11->iodev->regmap_pmic, s2mps11->reg, s2mps11->mask, ~s2mps11->mask); } @@ -186,15 +182,15 @@ static int s2mps11_clk_probe(struct platform_device *pdev) struct clk_init_data *clks_init; int i, ret = 0; - s2mps11_clks = devm_kzalloc(&pdev->dev, sizeof(*s2mps11_clk) * - S2MPS11_CLKS_NUM, GFP_KERNEL); + s2mps11_clks = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM, + sizeof(*s2mps11_clk), GFP_KERNEL); if (!s2mps11_clks) return -ENOMEM; s2mps11_clk = s2mps11_clks; - clk_table = devm_kzalloc(&pdev->dev, sizeof(struct clk *) * - S2MPS11_CLKS_NUM, GFP_KERNEL); + clk_table = devm_kcalloc(&pdev->dev, S2MPS11_CLKS_NUM, + sizeof(struct clk *), GFP_KERNEL); if (!clk_table) return -ENOMEM; @@ -322,7 +318,7 @@ static int __init s2mps11_clk_init(void) } subsys_initcall(s2mps11_clk_init); -static void __init s2mps11_clk_cleanup(void) +static void __exit s2mps11_clk_cleanup(void) { platform_driver_unregister(&s2mps11_clk_driver); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/