From patchwork Mon Mar 4 13:43:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Bolle X-Patchwork-Id: 17105 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1UCVgC-0006Nr-Na; Mon, 04 Mar 2013 14:43:48 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp id 1UCVgB-0002jq-CM; Mon, 04 Mar 2013 14:43:48 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755820Ab3CDNn1 (ORCPT + 1 other); Mon, 4 Mar 2013 08:43:27 -0500 Received: from cpsmtpb-ews05.kpnxchange.com ([213.75.39.8]:59332 "EHLO cpsmtpb-ews05.kpnxchange.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754497Ab3CDNn0 (ORCPT ); Mon, 4 Mar 2013 08:43:26 -0500 Received: from cpsps-ews26.kpnxchange.com ([10.94.84.192]) by cpsmtpb-ews05.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 4 Mar 2013 14:41:55 +0100 Received: from CPSMTPM-TLF103.kpnxchange.com ([195.121.3.6]) by cpsps-ews26.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 4 Mar 2013 14:41:55 +0100 Received: from [192.168.1.103] ([212.123.139.93]) by CPSMTPM-TLF103.kpnxchange.com with Microsoft SMTPSVC(7.5.7601.17514); Mon, 4 Mar 2013 14:43:20 +0100 Message-ID: <1362404600.16460.26.camel@x61.thuisdomein> Subject: [PATCH] [media] m920x: let GCC see 'ret' is used initialized From: Paul Bolle To: Mauro Carvalho Chehab Cc: Antonio Ospite , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 04 Mar 2013 14:43:20 +0100 X-Mailer: Evolution 3.4.4 (3.4.4-2.fc17) Mime-Version: 1.0 X-OriginalArrivalTime: 04 Mar 2013 13:43:20.0449 (UTC) FILETIME=[3BBECF10:01CE18DE] X-RcptDomain: vger.kernel.org Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2013.3.4.133316 X-PMX-Spam: Gauge=IIIIIIIII, Probability=9%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, MIME_LOWER_CASE 0.05, MSGID_ADDED_BY_MTA 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_1600_1699 0, BODY_SIZE_2000_LESS 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, CT_TEXT_PLAIN_UTF8_CAPS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_XOAT 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __TO_MALFORMED_2 0, __URI_NO_WWW 0, __URI_NS ' Since commit 7543f344e9b06afe86b55a2620f5c11b38bd5642 ("[media] m920x: factor out a m920x_write_seq() function") building m920x.o triggers this GCC warning: drivers/media/usb/dvb-usb/m920x.c: In function ‘m920x_probe’: drivers/media/usb/dvb-usb/m920x.c:91:6: warning: ‘ret’ may be used uninitialized in this function [-Wuninitialized] This warning is caused by m920x_write_seq(), which is apparently inlined into m920x_probe(). It is clear why GCC thinks 'ret' may be used uninitialized. But in practice the first seq->address will always be non-zero when this function is called. That means we can change the while()-do{} loop into a do{}-while() loop. And that suffices to make GCC see that 'ret' will not be used uninitialized. Signed-off-by: Paul Bolle --- Compile tested only! drivers/media/usb/dvb-usb/m920x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c index 92afeb2..79b31ae 100644 --- a/drivers/media/usb/dvb-usb/m920x.c +++ b/drivers/media/usb/dvb-usb/m920x.c @@ -68,13 +68,13 @@ static inline int m920x_write_seq(struct usb_device *udev, u8 request, struct m920x_inits *seq) { int ret; - while (seq->address) { + do { ret = m920x_write(udev, request, seq->data, seq->address); if (ret != 0) return ret; seq++; - } + } while (seq->address); return ret; }