From patchwork Sun Mar 31 10:12:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean Delvare X-Patchwork-Id: 2368321 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BF0BCDF264 for ; Sun, 31 Mar 2013 10:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753889Ab3CaKMh (ORCPT ); Sun, 31 Mar 2013 06:12:37 -0400 Received: from zoneX.GCU-Squad.org ([194.213.125.0]:40425 "EHLO services.gcu-squad.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751333Ab3CaKMg (ORCPT ); Sun, 31 Mar 2013 06:12:36 -0400 Received: from jdelvare.pck.nerim.net ([62.212.121.182] helo=endymion.delvare) by services.gcu-squad.org (GCU Mailer Daemon) with esmtpsa id 1UMFFY-0005eB-DS (TLSv1:AES128-SHA:128) (envelope-from ) ; Sun, 31 Mar 2013 12:12:32 +0200 Date: Sun, 31 Mar 2013 12:12:26 +0200 From: Jean Delvare To: Linux Media Cc: Mauro Carvalho Chehab , Antonio Ospite Subject: [media] m920x: Fix uninitialized variable warning Message-ID: <20130331121226.0b0e9e26@endymion.delvare> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.14; x86_64-suse-linux-gnu) Mime-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org drivers/media/usb/dvb-usb/m920x.c:91:6: warning: "ret" may be used uninitialized in this function [-Wuninitialized] drivers/media/usb/dvb-usb/m920x.c:70:6: note: "ret" was declared here This is real, if a remote control has an empty initialization sequence we would get success or failure randomly. OTOH the initialization of ret in m920x_init is needless, the function returns with an error as soon as an error happens, so the last return can only be a success and we can hard-code 0 there. Signed-off-by: Jean Delvare Cc: Mauro Carvalho Chehab Cc: Antonio Ospite --- Untested, I don't have the hardware. drivers/media/usb/dvb-usb/m920x.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- linux-3.9-rc4.orig/drivers/media/usb/dvb-usb/m920x.c 2013-03-05 10:33:29.497926362 +0100 +++ linux-3.9-rc4/drivers/media/usb/dvb-usb/m920x.c 2013-03-31 11:25:54.009509019 +0200 @@ -67,7 +67,8 @@ static inline int m920x_write(struct usb static inline int m920x_write_seq(struct usb_device *udev, u8 request, struct m920x_inits *seq) { - int ret; + int ret = 0; + while (seq->address) { ret = m920x_write(udev, request, seq->data, seq->address); if (ret != 0) @@ -81,7 +82,7 @@ static inline int m920x_write_seq(struct static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) { - int ret = 0, i, epi, flags = 0; + int ret, i, epi, flags = 0; int adap_enabled[M9206_MAX_ADAPTERS] = { 0 }; /* Remote controller init. */ @@ -124,7 +125,7 @@ static int m920x_init(struct dvb_usb_dev } } - return ret; + return 0; } static int m920x_init_ep(struct usb_interface *intf)