From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752790AbcKQJZI (ORCPT ); Thu, 17 Nov 2016 04:25:08 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:51439 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751762AbcKQJZE (ORCPT ); Thu, 17 Nov 2016 04:25:04 -0500 From: Arnd Bergmann To: Linus Walleij Cc: Maxime Ripard , Chen-Yu Tsai , "linux-gpio@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] pinctrl: sunxi: fix theoretical uninitialized variable access Date: Thu, 17 Nov 2016 10:24:28 +0100 Message-ID: <6865471.komOtxkTtZ@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: <20161116141841.2030776-1-arnd@arndb.de> <20161116203358.midi7vmaqirpywtt@lukather> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:tvpag5Z7dybLByUqi2LeeVf5cjQQf24x6aVNMDQLglt1ihzKDIK bonRZiRKTOKA8sxL0vtRvSr0JFlPySuRqmXx/86QxJ7j5lq0mlUX5Bs3/EuPnxvI/pma8Kz KmZL7PmZq4rhgzgewXNuwrEMVlSmjUWs/0k5YYkv6jSeX6opJtX3370Aem4818BIza0glea 2KH97qSlDxAPSobfUxrrg== X-UI-Out-Filterresults: notjunk:1;V01:K0:W/NDG/nhWNI=:w9/+9DQpC0kepWsorPlH43 h/7KsxfD2ae2QGB3DwCPhsndT7ZjXXQZJYyZUSadZYhqKp2anuS/er/CF/53zyMEpHL2j24wS wqr1u90u9s/WwbcS03FIHsfTS9Mp+zc0+0nI/vhfO1uvIKhWMURQxa1yn6MIBvQgTzfdyrdlK bAeqdbO7UHZTP4pQuKOINSBS3wsGOfFUoiJ19ovOcFNneCtNa4KFqr9A2jQt0TjVU0Fzulwgt CD6eo1JkFUCuJ7uOQJIv/gk/BCpBy/CNDhW/uupRRigGh/ypAsou3g+9urbwTcinrI81VLJTv XNVR0Az0gGcTrSWVLj7CsKzZrbIqvNfBYueNDQ5GzwTvIP7LsnUfbK4BDjZ3XWKEWmKEw+BR1 mnayIqw3B5ZSeBK7uRZxXvxq+4EmVdD98kovY4P/DLsq3JLNcMrgZmfCG549IYaaRog5O3DYC Xsiu3XiGzDh9edlwBr+U08OyZh22Xa+LTOvJBR7cqMDzdjwjllmClcQ1el+SL2vdxdL9Z5etM I7B7KPemO/GsbLGLMRjAsu2hGOKYFHbV9t+/cFLgSsXlnot7gIyxYcsKAmCs5/RSC4Mq7ohWI wTtoHliSYWSUCfmaB95VmzKyxD+Q06hjne41yClon+GEnXZ1VAHXzm/q6syDFGAq8eyh5B1h2 Da5x4CKE4JknhsUzYzIfK6HI9sP0N145HkkbswfFXFIVD9G9nAFmrInk0faYo9TLd0hlHi4o3 zCUuruvFkAy9YOkr Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, November 17, 2016 10:08:28 AM CET Linus Walleij wrote: > On Wed, Nov 16, 2016 at 9:33 PM, Maxime Ripard > wrote: > > > On Wed, Nov 16, 2016 at 03:18:18PM +0100, Arnd Bergmann wrote: > >> gcc warns about a way that it could use an uninitialized variable: > >> > >> drivers/pinctrl/sunxi/pinctrl-sunxi.c: In function 'sunxi_pinctrl_init': > >> drivers/pinctrl/sunxi/pinctrl-sunxi.c:1191:8: error: 'best_div' may be used uninitialized in this function [-Werror=maybe-uninitialized] > >> > >> This cannot really happen except if 'freq' is UINT_MAX and 'clock' is > >> zero, and both of these are forbidden. To shut up the warning anyway, > >> this changes the logic to initialize the return code to the first > >> divider value before looking at the others. > >> > >> Fixes: 7c926492d38a ("pinctrl: sunxi: Add support for interrupt debouncing") > >> Signed-off-by: Arnd Bergmann > > > > Thanks for that patch. > > > > Just out of curiosity, which gcc gives those warnings? I have 6.2 and > > it didn't output anything.. > > Context: Arnd re-enabled -Werror=maybe-uninitialized > in the kernel build and this kind of stuff started to appear so > it needs to be fixed up. Right, it was disabled from linux-4.8-rc1 to linux-4.9-rc4 and is now back in the default builds when using gcc-4.9 or higher. You should get the warning if you test with linux-next or -rc4. Arnd