From patchwork Tue Mar 7 22:45:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ondrej Zary X-Patchwork-Id: 65913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4328wrd; Tue, 7 Mar 2023 14:49:13 -0800 (PST) X-Google-Smtp-Source: AK7set+cNpweFjg83fEhTat0MHLHiMfqHtPITjjy9/sAvg0SLGqUFgadfLeazqbygSWnoX1Kv7PY X-Received: by 2002:a05:6a20:8f08:b0:c7:6a98:5bdc with SMTP id b8-20020a056a208f0800b000c76a985bdcmr22655128pzk.16.1678229353122; Tue, 07 Mar 2023 14:49:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678229353; cv=none; d=google.com; s=arc-20160816; b=xweGW7YSHdLpVWTFOjlS2ZfAQuc7z6oudECuNw50RfrEo3bMYt5l4NgxFtX+qOabDk fPtQTptbnXNnj6b4aAtP9UyQWklrtwSotnplwjg4kZxZKxAwP0INfY3Ujq3CvlZwylCt dk02uxkbW+J01W4xvRO+qxflZTcz/YKXJqU2+OWdaTq4aKtlX4RMTwmO12Z1ZxOZYUIq nJKFKsCmnoDTZnDVOlUS8skHEy23Ey9UZGLRwM8zVuZYXd/Z6FuIkAe89IBH4qNxZdh6 vWlfVYrQpYEOgSfJMMzOzV4rp6yNOBKNiaF4+NWBbBK9Jqsx8jrZgeBOxHH+EzofJK/F wnSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=3ZYTcDywHAsg7C0/nIRKYixVJiJWcgs7VJahRV23Xfw=; b=opCAxOXkQwmPN1bKs9MXWV2do8opJl2mk+/oEwx9U3RioMqTXahx1wP/EtIC4tNm5k O5gPsS11sfzRSKKWJRBaOsoPY1x/sPAEPXBl4th1RwX5dZ30r38yuhGI73hmOrqOSdPU p6SwEd6hlJFtkegKGIFjFkqyStReR2hfCzYdlXghNWtWcEb4F511eE3JtJp7F63A2kCq NzsbjO1dh2OLrj1cCV2p8WN8ZjBZ3PTboQOc40AhWmb5S4SV+P4O4lEWjuYjoKzQFQXd DatXhnvyO3MW4kat6KUNZx8Ar/TEMTyr5LiLMlV0EoT8wg41SKwriv60k1pYskg6C6q2 F7gQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q32-20020a635c20000000b004e658a3b1b0si12415044pgb.183.2023.03.07.14.48.31; Tue, 07 Mar 2023 14:49:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229758AbjCGWrD (ORCPT + 99 others); Tue, 7 Mar 2023 17:47:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbjCGWrA (ORCPT ); Tue, 7 Mar 2023 17:47:00 -0500 Received: from hosting.gsystem.sk (hosting.gsystem.sk [212.5.213.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3E0E059D9; Tue, 7 Mar 2023 14:46:49 -0800 (PST) Received: from gsql.ggedos.sk (off-20.infotel.telecom.sk [212.5.213.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by hosting.gsystem.sk (Postfix) with ESMTPSA id 053947A0533; Tue, 7 Mar 2023 23:46:48 +0100 (CET) From: Ondrej Zary To: Damien Le Moal , Sudip Mukherjee Cc: Christoph Hellwig , Sergey Shtylyov , Jens Axboe , Tim Waugh , linux-block@vger.kernel.org, linux-parport@lists.infradead.org, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/32] pata_parport-bpck6: remove useless range check from read/write_regr Date: Tue, 7 Mar 2023 23:45:57 +0100 Message-Id: <20230307224627.28011-3-linux@zary.sk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230307224627.28011-1-linux@zary.sk> References: <20230307224627.28011-1-linux@zary.sk> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759751022450608944?= X-GMAIL-MSGID: =?utf-8?q?1759751022450608944?= bpck6_read_regr() and bpck6_write_regr() check values of cont and reg but there's no point in doing that. They can only be called with a fixed set of values. Remove the checks. Signed-off-by: Ondrej Zary Reviewed-by: Sergey Shtylyov --- drivers/ata/pata_parport/bpck6.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/drivers/ata/pata_parport/bpck6.c b/drivers/ata/pata_parport/bpck6.c index 842e8116b649..4d6edb9c1245 100644 --- a/drivers/ata/pata_parport/bpck6.c +++ b/drivers/ata/pata_parport/bpck6.c @@ -25,24 +25,12 @@ static int bpck6_read_regr(struct pi_adapter *pi, int cont, int reg) { - unsigned int out; - - /* check for bad settings */ - if (reg<0 || reg>7 || cont<0 || cont>2) - { - return(-1); - } - out=ppc6_rd_port(PPCSTRUCT(pi),cont?reg|8:reg); - return(out); + return ppc6_rd_port(PPCSTRUCT(pi), cont?reg|8:reg); } static void bpck6_write_regr(struct pi_adapter *pi, int cont, int reg, int val) { - /* check for bad settings */ - if (reg>=0 && reg<=7 && cont>=0 && cont<=1) - { - ppc6_wr_port(PPCSTRUCT(pi),cont?reg|8:reg,(u8)val); - } + ppc6_wr_port(PPCSTRUCT(pi), cont?reg|8:reg, val); } static void bpck6_write_block(struct pi_adapter *pi, char *buf, int len)