From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753492AbdFMOBk (ORCPT ); Tue, 13 Jun 2017 10:01:40 -0400 Received: from lelnx193.ext.ti.com ([198.47.27.77]:25376 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752326AbdFMOBi (ORCPT ); Tue, 13 Jun 2017 10:01:38 -0400 Subject: Re: [PATCH 1/2] regulator: tps65910: check TPS65910_NUM_REGS at build time To: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , References: <0c5e903eed2005e39bdf7abdd1061dffc078109a.1497361550.git.mirq-linux@rere.qmqm.pl> CC: Liam Girdwood , Mark Brown , Tony Lindgren , From: Keerthy Message-ID: <8d9e234b-8963-8ee8-8330-cfbe04f4a119@ti.com> Date: Tue, 13 Jun 2017 19:31:21 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 In-Reply-To: <0c5e903eed2005e39bdf7abdd1061dffc078109a.1497361550.git.mirq-linux@rere.qmqm.pl> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 13 June 2017 07:28 PM, Michał Mirosław wrote: Missing commit log? > 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; > >