From patchwork Wed Jan 27 15:57:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 101061 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2664146lbb; Wed, 27 Jan 2016 07:59:49 -0800 (PST) X-Received: by 10.98.75.156 with SMTP id d28mr44056455pfj.108.1453910389800; Wed, 27 Jan 2016 07:59:49 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rm10si10276760pab.25.2016.01.27.07.59.49; Wed, 27 Jan 2016 07:59:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754858AbcA0P7q (ORCPT + 30 others); Wed, 27 Jan 2016 10:59:46 -0500 Received: from mout.kundenserver.de ([217.72.192.74]:65525 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753248AbcA0P7m (ORCPT ); Wed, 27 Jan 2016 10:59:42 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue102) with ESMTPA (Nemesis) id 0LymAB-1a4ARB2PqB-016BwE; Wed, 27 Jan 2016 16:59:06 +0100 From: Arnd Bergmann To: "Martin K. Petersen" , James.Bottomley@HansenPartnership.com Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-scsi@vger.kernel.org, "James E.J. Bottomley" , linux-kernel@vger.kernel.org Subject: [PATCH 6/7] scsi: aha1542: avoid uninitialized variable warnings Date: Wed, 27 Jan 2016 16:57:22 +0100 Message-Id: <1453910247-3447628-7-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1453910247-3447628-1-git-send-email-arnd@arndb.de> References: <1453910247-3447628-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:WqFAMkCis1TjQHB7rawQrJYobx9/XSRFP2bYxc4Ev/uh58g4Xk2 YXOppWJ9G3/bI9oEW2WnJtb7HAv3E3OsF586DLJDwSZfZbkGVxGR+4t/8l0CzuVtYFOZDGQ vH3o05kL2JMRLrKtQoL+E8Cro9uf8dkxSksw1ANR/tmgvC7VDRKbWysCxhjrmH7vEmGsVEL CqMI4dlKiCNBtPxPQp/xQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:5Ec4e406wUY=:6/qOgvD1oSUREOlg61Ch3s kr/MLYDZ1qFMf46EbbZ7SbWtR0A7wCnzxiVk7jBuNOQdW22Tn0k6PthDvhSJjyIBRqqBORGKy am2bfvThMju0wyO3U+oqXgQgMxBAouRMScwRVGYsUiz3IUtFM7Vk7NjEFZljpEN/oq/63pC+Z xUnjST0pc1xMBAZgxCgOK+FMIVoIelInFdX3+4puWUJL3p9BB5JNHnKrD+wn6WANOwVWcg06a h97vkPJR5THBs40CYmED+/cLTECEJFq0FC1u/d5l39xh9S/38bnEEgyyR9XGpmf5JrO0DGa02 2k0HxPAGZVyUKnL0ekZk03k7rj2+LLzMdUPkdooJKWgAPYOZv7QjyrckVDJfeROvdL9GkFolX FVrjsVHAqlo33kz5/pJNWtA0OLFCIgjZNliteGCBYRmXDx99Yi05aQENIttjGigtsDk+FPJnh iZsybVmE/oDHSw24CKr3x69e0KvyQGYYffhEvjzdDljYq+N6Dwb8wxyZOWFuxfBnWrHI2i2HF VdbUOKHf767GtI4IAGhnt9+/4OaIYli9Hx7n5wkciNdoQhKFvSKNi0lkl3Dxz3uUMwEpQgzas pYWOFtFKImQaL+oof8O1tUUQgE0X26YFt2tHWv77xG7Ju7XirLnnEOLumcvaRz1i0YVB9QKhJ cu3ssm/5HBIwf/S3PHCg2VkB5EQoOxpXcwgCdlo1gna2lQCdNMEXXaC4MDAyMfXgFkWQ= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gcc incorrectly detects that two variables in aha1542_queuecommand might be used without an initialization: scsi/aha1542.c: In function 'aha1542_queuecommand': scsi/aha1542.c:382:16: error: 'cptr' may be used uninitialized in this function [-Werror=maybe-uninitialized] scsi/aha1542.c:379:11: error: 'sg_count' may be used uninitialized in this function [-Werror=maybe-uninitialized] The only user of these is doing the same check that the assigment has, so it is actually guaranteed to work. Adding an "else" clause with a fake initialization shuts up the warning. Signed-off-by: Arnd Bergmann --- drivers/scsi/aha1542.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.7.0 diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 5b8b2937a3fe..7db448ec8beb 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c @@ -403,6 +403,9 @@ static int aha1542_queuecommand(struct Scsi_Host *sh, struct scsi_cmnd *cmd) cptr = kmalloc(sizeof(*cptr) * sg_count, GFP_KERNEL | GFP_DMA); if (!cptr) return SCSI_MLQUEUE_HOST_BUSY; + } else { + sg_count = 0; + cptr = NULL; } /* Use the outgoing mailboxes in a round-robin fashion, because this