From patchwork Mon May 9 18:44:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petros Koutoupis X-Patchwork-Id: 9048951 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8ABDB9F1C3 for ; Mon, 9 May 2016 18:44:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD19B20148 for ; Mon, 9 May 2016 18:44:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7DD5E2012B for ; Mon, 9 May 2016 18:44:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751072AbcEISoT (ORCPT ); Mon, 9 May 2016 14:44:19 -0400 Received: from mout.perfora.net ([74.208.4.197]:64764 "EHLO mout.perfora.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751001AbcEISoT convert rfc822-to-8bit (ORCPT ); Mon, 9 May 2016 14:44:19 -0400 Received: from [10.10.50.63] ([67.92.53.130]) by mrelay.perfora.net (mreueus001) with ESMTPSA (Nemesis) id 0MHF2L-1anTwr29Ct-00E3sf; Mon, 09 May 2016 20:44:14 +0200 Message-ID: <1462819450.16056.2.camel@petroskoutoupis.com> Subject: [PATCH] hpsa: Fix type ZBC conditional checks From: Petros Koutoupis To: don.brace@microsemi.com Cc: petros@petroskoutoupis.com, linux-scsi@vger.kernel.org, iss_storagedev@hp.com, esc.storagedev@microsemi.com Date: Mon, 09 May 2016 13:44:10 -0500 X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 X-Provags-ID: V03:K0:BUE3VATvWWkzDlMNAP2VxoJBDkFxaJnCWWHAdXJtgCOYjO6weOJ GvHMHrNC//NZeL3Uwq3x0bta9TbAluEDAGLRkH5mw4bx7R8jqt+BUoYqPvn3f/fR82l++zr CV7CrldQRpdK9BYwtPItGkiV3cW9mRBnE0MTXKMpvAmKOefjDynZSIFKWMditLxngydyG95 GAkQET/TwyHmYEWZSNzbA== X-UI-Out-Filterresults: notjunk:1; V01:K0:FdlPzMb+MbI=:welYL+tBN6psHUvm1ZmpnI i5NXpi5aR+H9xcvLbmy6rcMcLbImWaV8xRm/JwdaHw6KskYe1Xf1x2S32LvopyN99MbA+6TgE 893YKtm4Sd7y3Ogob5l5DyfG6tqjMEWUgk1m0qg59kL4lcQ6lnwDu99bX7XVgWaIr07L++TH4 wVVBSRLuoBGpjNW1KLKj61+taxOIR8a16aaMWWCO0arQCee7XfK9u/AHOAeEBsGNhFFIMwHNL faDXy7qcQdXHYDfWVygAeF8zyicGH66keZ6+J/jrlPyANDaj+k5up0RVqssYj2qB3Wxnw2C1a kiUKc7DihL/8SGkBmNkYc+TWGDSBPGdXHhBUSOZlfirf4EPHzBf85TSfQ9JTxHM6EvkpkPZ14 ZkdO5G9QHbguzcBOT0ncefwyQcZVDCf0600a8SgFPSEzPzv4ZOX+xIMhoWatwMUGBlwaGRtCa +N4lMM1IhBZ960+zgD6KofB0wYZ5qMyRN7oTJIAyEuKc0DIj3BvxFztdKMwe2lf2b3SNyq+jH Hll8RVTVqg2HJp+hcMVHzrOopBZP8ACRrpYlibw/2leEp/h1Vt7g03Sv/6yHs51rFeoOrk88R G13K07xJRWqaPwqGysYzNwRocv6ENqZVujrvasmTp30DqGux1hguMQB+Se0I/dor8i4InoCMO IBi9Jq9ZeJoNxchS27MQCzz13YGEF9p8g/Zr4eZXnRVzxDjBZnKd1pbgAn90ezUqV7ijKhwPX +QBe0RotepxHQ39Z Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The device ID obtained from the inquiry can only be of a single type. The original code places a check for TYPE_ZBC right after the check for TYPE_DISK. Logically, if the first if statement sees a device of a TYPE_DISK and moves on to the second statement checking if not TYPE_ZBC, it will always hit the continue. Signed-off-by: Petros Koutoupis Acked-by: Don Brace --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux/drivers/scsi/hpsa.c.orig 2016-04-27 21:43:44.463140419 -0500 +++ linux/drivers/scsi/hpsa.c 2016-04-27 22:45:31.015140419 -0500 @@ -1637,9 +1637,8 @@ static void hpsa_figure_phys_disk_ptrs(s   for (j = 0; j < ndevices; j++) {   if (dev[j] == NULL)   continue; - if (dev[j]->devtype != TYPE_DISK) - continue; - if (dev[j]->devtype != TYPE_ZBC) + if ((dev[j]->devtype != TYPE_DISK) && +     (dev[j]->devtype != TYPE_ZBC))   continue;   if (is_logical_device(dev[j]))   continue; @@ -1684,9 +1683,8 @@ static void hpsa_update_log_drive_phys_d   for (i = 0; i < ndevices; i++) {   if (dev[i] == NULL)   continue; - if (dev[i]->devtype != TYPE_DISK) - continue; - if (dev[i]->devtype != TYPE_ZBC) + if ((dev[i]->devtype != TYPE_DISK) && +     (dev[i]->devtype != TYPE_ZBC))   continue;   if (!is_logical_device(dev[i]))   continue;