From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030644AbdAKQLA (ORCPT ); Wed, 11 Jan 2017 11:11:00 -0500 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:23178 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030625AbdAKQK6 (ORCPT ); Wed, 11 Jan 2017 11:10:58 -0500 Subject: Re: [PATCH] clk: stm32f4: avoid uninitialized variable access To: Arnd Bergmann , Michael Turquette , Stephen Boyd References: <20170111134107.3821564-1-arnd@arndb.de> CC: Maxime Coquelin , Alexandre Torgue , Rob Herring , Christophe JAILLET , , , From: Gabriel Fernandez Message-ID: Date: Wed, 11 Jan 2017 17:08:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170111134107.3821564-1-arnd@arndb.de> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG4NODE2.st.com (10.75.127.11) To SFHDAG4NODE2.st.com (10.75.127.11) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-01-11_13:,, signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/11/2017 02:40 PM, Arnd Bergmann wrote: > The failure path in the newly added function tries to free an > uninitialized pointer: > > drivers/clk/clk-stm32f4.c: In function 'stm32f4_rcc_init': > drivers/clk/clk-stm32f4.c:1106:4: error: 'gate' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > I'm adding an initialization to NULL here to make the kfree() > succeed, and I'm also rearranging the cleanup so that the > same kfree() is used for any error path, making the function > slightly more robust against newly introduced bugs in the > error handling. > > Fixes: daf2d117cbca ("clk: stm32f4: Add lcd-tft clock") > Signed-off-by: Arnd Bergmann > --- > drivers/clk/clk-stm32f4.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > Acked-by: Gabriel Fernandez