From patchwork Sun Oct 15 19:35:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christos Gkekas X-Patchwork-Id: 10007243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7A9BC60230 for ; Sun, 15 Oct 2017 19:35:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 597DA223A5 for ; Sun, 15 Oct 2017 19:35:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B3D123B23; Sun, 15 Oct 2017 19:35:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDE4E223A5 for ; Sun, 15 Oct 2017 19:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751339AbdJOTfK (ORCPT ); Sun, 15 Oct 2017 15:35:10 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:35512 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751321AbdJOTfJ (ORCPT ); Sun, 15 Oct 2017 15:35:09 -0400 Received: by mail-wm0-f67.google.com with SMTP id b189so6076772wmd.2; Sun, 15 Oct 2017 12:35:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=WA//bbV0gYbV40pEqPV2GSTia9Su+bTycPaNhLbGkvM=; b=gNfQZ836b+N1IWZjaBxgqGCsAhZLfd+dWtvIX038nobuaYwhJLuRc4c3upAgqAZNVJ EpD40NugHEbd1bubIYiesT0P+vDyPZJFnGrHfa36t7ZahSue1tCJKjU5IZdvEn6pe/w5 dzpCU+pyeHyvMBEfoSy7aE/wry7vRXOof2hYhckAhXmFvERop43EX87yjPu3A+vQiQLO E5X7eFmi7kylqgMS8Yec/AisvM0h7qTTCKA5TXY0f6pyeLBWy2ph0AsawCAZn80Pqcrp WQZU7CNBGx6gRfYQby2yLLaDwOASusgsNPI9P9W6tOcm/oGbuyCGaNHVIcS4IpWDltfI qzpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WA//bbV0gYbV40pEqPV2GSTia9Su+bTycPaNhLbGkvM=; b=Zn4KsQEiDK9/pY0O8wUEXaMGLyW2LWI1uE7Uk4SNC+4shUsnonagg1UJef9JplVlq/ wabwzaFlDeHX42EuVp532s4b5/6PDbtBv3XAnbIpWdRhkXB3W1LRD6JR1vIrSCQ4X5Lx zCvAe/IIInlgJKxbysW+a3jf0q7wVGza0ivSmDLjVWTsFYhNQv//Vf1VqXaoA2i7b29E Wyn4nhh4e7Cs3Dzx6LW6Hu/Fpil5IV3Mv1OFlhDQAvWCEB2Hx575sPq4Wv48ZmRuEQnf ssEGC2cTmGAdNKMfxA7ROH3m5urkszvSGAa9meO3U66RCsQoFkKWg6YqWjok73IDlv1A SCqw== X-Gm-Message-State: AMCzsaXs4wOwryIcedF5oAr+Oyh74Lyu/BGvgRW7Z7lsBYal92ByTFMt skzJyTYBCdrSbOotL/HnDKslHHiaO5E= X-Google-Smtp-Source: AOwi7QAyPmjbjUMhmitCj1YYV3zDcKiuPxZfZFNhqBTcVfFN/MVFJ2Wv9ScSZUUQDopeynEvijUqcA== X-Received: by 10.223.157.141 with SMTP id p13mr6749690wre.92.1508096108022; Sun, 15 Oct 2017 12:35:08 -0700 (PDT) Received: from inspiron ([2a02:c7d:5e0c:c300:8c9:8234:a4cb:840a]) by smtp.gmail.com with ESMTPSA id r123sm4044949wmf.41.2017.10.15.12.35.06 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 15 Oct 2017 12:35:06 -0700 (PDT) From: Christos Gkekas To: Don Brace , "James E.J. Bottomley" , "Martin K. Petersen" , esc.storagedev@microsemi.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christos Gkekas Subject: [PATCH] scsi: hpsa: simplify hpsa_set_local_logical_count() Date: Sun, 15 Oct 2017 20:35:03 +0100 Message-Id: <1508096103-6751-1-git-send-email-chris.gekas@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Variable configured_logical_drive_count is defined as u8 and thus the nested if statement always evaluates to true. Remove it and simplify. Signed-off-by: Christos Gkekas --- drivers/scsi/hpsa.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 9abe810..7d4f139 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -4090,14 +4090,7 @@ static int hpsa_set_local_logical_count(struct ctlr_info *h, } memset(id_ctlr, 0, sizeof(*id_ctlr)); rc = hpsa_bmic_id_controller(h, id_ctlr, sizeof(*id_ctlr)); - if (!rc) - if (id_ctlr->configured_logical_drive_count < 256) - *nlocals = id_ctlr->configured_logical_drive_count; - else - *nlocals = le16_to_cpu( - id_ctlr->extended_logical_unit_count); - else - *nlocals = -1; + *nlocals = rc ? -1 : id_ctlr->configured_logical_drive_count; return rc; }