From patchwork Tue Jun 13 13:58:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 9783963 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65633602DC for ; Tue, 13 Jun 2017 13:59:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BFE628651 for ; Tue, 13 Jun 2017 13:59:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5071328706; Tue, 13 Jun 2017 13:59:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDDD228651 for ; Tue, 13 Jun 2017 13:59:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753349AbdFMN7h (ORCPT ); Tue, 13 Jun 2017 09:59:37 -0400 Received: from [91.227.64.183] ([91.227.64.183]:51366 "EHLO rere.qmqm.pl" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1753453AbdFMN7G (ORCPT ); Tue, 13 Jun 2017 09:59:06 -0400 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id B1FA12C; Tue, 13 Jun 2017 15:58:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1497362333; bh=hSFZNmRUiYQZjkcEDXxgNOrpqi/3damlPWUwWEaraZQ=; h=Date:From:Subject:To:Cc:From; b=rXGwgGvfVgsn/BHoJ/37RVkq72kMrRy5XD5hs30km9oNpkWT9kg1jysATKCEY+C9n v5gx86U6aGAu9nMBTFkZe3vZGq+QpFPB0yt0vc9ra3x/V2mWAf/nNLwGHc4rrWWLoe 3mnmd0+GUdUSjGr0itYn83/Lx/m8LtG88d3N2/y3FZGbDBMzTz8rmljBspcrUSIYPz 9qFENUYkT7l0VLZhbz8kfpyZpthrgjBLdFHYw80FKkCxMQ/mntnBrz502BP+VV/HnI G8sEMDofa9DuH6vZ5GL99ydWfMAwyufhoFV0N+s0JCYHv0HtWuoCBwA2Tas9tAT4mv t8vwimvQLYxmA== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.99.2 at rere Date: Tue, 13 Jun 2017 15:58:53 +0200 Message-Id: <0c5e903eed2005e39bdf7abdd1061dffc078109a.1497361550.git.mirq-linux@rere.qmqm.pl> From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= Subject: [PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time MIME-Version: 1.0 To: linux-kernel@vger.kernel.org Cc: Liam Girdwood , Mark Brown , Tony Lindgren , linux-omap@vger.kernel.org Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Michał Mirosław --- drivers/regulator/tps65910-regulator.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c index 696116ebdf50a..81672a58fcc23 100644 --- a/drivers/regulator/tps65910-regulator.c +++ b/drivers/regulator/tps65910-regulator.c @@ -1107,6 +1107,7 @@ static int tps65910_probe(struct platform_device *pdev) switch (tps65910_chip_id(tps65910)) { case TPS65910: + BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65910_regs)); pmic->get_ctrl_reg = &tps65910_get_ctrl_register; pmic->num_regulators = ARRAY_SIZE(tps65910_regs); pmic->ext_sleep_control = tps65910_ext_sleep_control; @@ -1119,6 +1120,7 @@ static int tps65910_probe(struct platform_device *pdev) DCDCCTRL_DCDCCKSYNC_MASK); break; case TPS65911: + BUILD_BUG_ON(TPS65910_NUM_REGS < ARRAY_SIZE(tps65911_regs)); pmic->get_ctrl_reg = &tps65911_get_ctrl_register; pmic->num_regulators = ARRAY_SIZE(tps65911_regs); pmic->ext_sleep_control = tps65911_ext_sleep_control; @@ -1144,8 +1146,7 @@ static int tps65910_probe(struct platform_device *pdev) if (!pmic->rdev) return -ENOMEM; - for (i = 0; i < pmic->num_regulators && i < TPS65910_NUM_REGS; - i++, info++) { + for (i = 0; i < pmic->num_regulators; i++, info++) { /* Register the regulators */ pmic->info[i] = info;