From patchwork Mon May 2 16:39:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petros Koutoupis X-Patchwork-Id: 8993851 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 52C589F1D3 for ; Mon, 2 May 2016 16:39:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 76AC4200E1 for ; Mon, 2 May 2016 16:39:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 429C720225 for ; Mon, 2 May 2016 16:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754274AbcEBQjZ (ORCPT ); Mon, 2 May 2016 12:39:25 -0400 Received: from mout.perfora.net ([74.208.4.194]:53566 "EHLO mout.perfora.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754161AbcEBQjV convert rfc822-to-8bit (ORCPT ); Mon, 2 May 2016 12:39:21 -0400 Received: from [10.10.50.63] ([67.92.53.130]) by mrelay.perfora.net (mreueus002) with ESMTPSA (Nemesis) id 0MatW0-1bGayn27Tu-00KRaE; Mon, 02 May 2016 18:39:15 +0200 Message-ID: <1462207152.5718.6.camel@petroskoutoupis.com> Subject: 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, 02 May 2016 11:39:12 -0500 X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 X-Provags-ID: V03:K0:HGGUgZ7r6aZ1NZmhozPoLIbPQZfYlHTrp7NnkQe5wo7go1AZ4s5 1AKbA5Z53MkCZITyhTHm9ldpjDI8frOAIolBj+9DdmposHEBzQ4DAhpZAZ/kWCWs8Wgrt7n vrOhx7PC33+EZrLn8LTi+55STMcV1/Um/N3+7wns4D3t5HvTO+H7YnhsT453OcOcqQ58hiT tbS3aYCxNqzMVuSP6CsGw== X-UI-Out-Filterresults: notjunk:1; V01:K0:iFYpHgrdr4E=:gonixocuiNDTtQEz0d3I45 gJNNiXOD0W8+SrOBiEOFTP4zwBn31a2L/9K2kImgiA+NGUsyqFZjyMGhYr2dAF3AnoR9SWxIn BIqpix2scYVr84uQYtJEcBs8J7HR5KziMBUan5NKJ1dt2Jsj6DckCyoWzTDZcquVkTVgYBBt9 NdbhFodp9juLUJsyvORYjf56kaKtWZ0FSUahGWZgQg2C6k3hriKemqBXJTpQh5vxpiFBUYZ5T /+Z8J9mYtbHRNYYSHsdZfFqis2nmFbDbePAGb8ufU44z3ujwt6ABZAM3irNads08gAxI5PvWI r8it7x7khzMWZJJEJwGlkpeVsxfvdlydSs/BKJP+Dc6Hxac0XsyRvE37oHDcEtAsfGvOKR1o1 2F4yJOsFaPCiqvqBqtPqAHSU3pfpaLCWiRrBmWRj2m8NKrlTY/IH7Xc2Uar26s4ffhpUXy7pY zmBifjS8SYWyiKpKo2itfU96+DEUsvSz7x7hNBoLOAOhMkll/hQQZgU/O+bF5ysMRUEHpbFCJ zZNIK8UGf6JKKtcFiis42NUZ58ezcaHoEgH7JHrDlOkzgVuJDTcbtZ+NV11MNSBZ5pXU60YmH ftrYBlVu+lpwA/5Dd1/6AgMi97e0dqMrH6CKXgGtbGm+MoimexQ3KVr6x5PbzgkBZp5oD+5gH U1gxGX99dMR+7/IH9mPYU6e2v9F9Ko0q103kwFwhsekL8QJVkxGlgWptFv3gqbogzaJfEY6AC pp0a7sMGLZz8ZMJT Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-7.9 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. --- 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;