From patchwork Tue Jan 6 20:17:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 16843 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 9739CDE5B0 for ; Wed, 7 Jan 2009 07:16:07 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751773AbZAFUQF (ORCPT ); Tue, 6 Jan 2009 15:16:05 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751787AbZAFUQF (ORCPT ); Tue, 6 Jan 2009 15:16:05 -0500 Received: from pfepa.post.tele.dk ([195.41.46.235]:55127 "EHLO pfepa.post.tele.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751773AbZAFUQF (ORCPT ); Tue, 6 Jan 2009 15:16:05 -0500 Received: from ravnborg.org (x1-6-00-1e-2a-84-ae-3e.k225.webspeed.dk [80.163.61.94]) by pfepa.post.tele.dk (Postfix) with ESMTP id AC875A50028; Tue, 6 Jan 2009 21:15:59 +0100 (CET) Received: by ravnborg.org (Postfix, from userid 500) id E64F2580D0; Tue, 6 Jan 2009 21:17:42 +0100 (CET) Date: Tue, 6 Jan 2009 21:17:42 +0100 From: Sam Ravnborg To: "David S. Miller" , sparclinux , Steven Rostedt Subject: [PATCH] sparc64: refactor code in viohs.c Message-ID: <20090106201742.GA17714@uranus.ravnborg.org> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.4.2.1i Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org The sparc64 allmodconfig build broke due to enabling of the branch_tracer that does some very clever things with all if conditions. This caused my gcc 3.4.5 to be so confused that it emitted a warning: arch/sparc/kernel/viohs.c: In function `vio_control_pkt_engine': arch/sparc/kernel/viohs.c:335: warning: 'nver' might be used uninitialized in this function And with -Werror this broke the build. Refactor code so it: 1) becomes more readable 2) no longer emit a warning with the branch_tracer enabled Signed-off-by: Sam Ravnborg Cc: Steven Rostedt --- -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/sparc/kernel/viohs.c b/arch/sparc/kernel/viohs.c index 708fa17..aa6ac70 100644 --- a/arch/sparc/kernel/viohs.c +++ b/arch/sparc/kernel/viohs.c @@ -337,8 +337,10 @@ static int process_ver_nack(struct vio_driver_state *vio, viodbg(HS, "GOT VERSION NACK maj[%u] min[%u] devclass[%u]\n", pkt->major, pkt->minor, pkt->dev_class); - if ((pkt->major == 0 && pkt->minor == 0) || - !(nver = find_by_major(vio, pkt->major))) + if (pkt->major == 0 && pkt->minor == 0) + return handshake_failure(vio); + nver = find_by_major(vio, pkt->major); + if (!nver) return handshake_failure(vio); if (send_version(vio, nver->major, nver->minor) < 0)