From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754022AbaDFNXP (ORCPT ); Sun, 6 Apr 2014 09:23:15 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:35731 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835AbaDFNXK (ORCPT ); Sun, 6 Apr 2014 09:23:10 -0400 MIME-Version: 1.0 In-Reply-To: References: <20140318110947.GR25478@lee--X1> <1395148286-32002-1-git-send-email-k.kozlowski@samsung.com> Date: Sun, 6 Apr 2014 15:23:09 +0200 X-Google-Sender-Auth: oU-Vf2Lvp6Fe4m-tAGoqAIkAxuc Message-ID: Subject: Re: [PATCH] mfd: sec-core: Fix uninitialized 'regmap_rtc' on S2MPA01 From: Geert Uytterhoeven To: Sachin Kamat Cc: Krzysztof Kozlowski , Lee Jones , Mark Brown , "devicetree@vger.kernel.org" , LKML Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 19, 2014 at 9:27 AM, Sachin Kamat wrote: > On 18 March 2014 18:41, Krzysztof Kozlowski wrote: >> Initialize the 'regmap_rtc' on S2MPA01 to some sane value. Sane at least >> for S5M87X chipsets, not S2MPS/S2MPA but it won't be used because >> rtc-s5m driver does not support S2MPA01. >> >> This fixes following error: >> drivers/mfd/sec-core.c:342:45: warning: 'regmap_rtc' may be used uninitialized in this function [-Wuninitialized] >> >> Signed-off-by: Krzysztof Kozlowski > > From the point of suppressing this warning and considering how it is > done for S2MPS11, > Acked-by: Sachin Kamat This is not just about suppressing a warning. The following may crash when passed a random pointer: sec_pmic->regmap_rtc = devm_regmap_init_i2c(sec_pmic->rtc, regmap_rtc); and if regmap_rtc happens to be NULL, devm_regmap_init_i2c() will return -EINVAL. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 From: Geert Uytterhoeven Subject: Re: [PATCH] mfd: sec-core: Fix uninitialized 'regmap_rtc' on S2MPA01 Date: Sun, 6 Apr 2014 15:23:09 +0200 Message-ID: References: <20140318110947.GR25478@lee--X1> <1395148286-32002-1-git-send-email-k.kozlowski@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Sachin Kamat Cc: Krzysztof Kozlowski , Lee Jones , Mark Brown , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , LKML List-Id: devicetree@vger.kernel.org On Wed, Mar 19, 2014 at 9:27 AM, Sachin Kamat wrote: > On 18 March 2014 18:41, Krzysztof Kozlowski wrote: >> Initialize the 'regmap_rtc' on S2MPA01 to some sane value. Sane at least >> for S5M87X chipsets, not S2MPS/S2MPA but it won't be used because >> rtc-s5m driver does not support S2MPA01. >> >> This fixes following error: >> drivers/mfd/sec-core.c:342:45: warning: 'regmap_rtc' may be used uninitialized in this function [-Wuninitialized] >> >> Signed-off-by: Krzysztof Kozlowski > > From the point of suppressing this warning and considering how it is > done for S2MPS11, > Acked-by: Sachin Kamat This is not just about suppressing a warning. The following may crash when passed a random pointer: sec_pmic->regmap_rtc = devm_regmap_init_i2c(sec_pmic->rtc, regmap_rtc); and if regmap_rtc happens to be NULL, devm_regmap_init_i2c() will return -EINVAL. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html