Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4070702rwl; Sun, 2 Apr 2023 22:20:47 -0700 (PDT) X-Google-Smtp-Source: AKy350auQgVZ5PT5vf4j+o56MpdpwnNVnaDUCA5fOt2mFXcwX/giAMG8501cfFIF4Y8wqarL+ZE3 X-Received: by 2002:a17:902:e812:b0:19c:e440:9256 with SMTP id u18-20020a170902e81200b0019ce4409256mr43828897plg.35.1680499246746; Sun, 02 Apr 2023 22:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680499246; cv=none; d=google.com; s=arc-20160816; b=nVYwLx16icWNuo6m0IycC7lL2L2vAD1CzmADerz/aSOF4b2UcdZtPlzG9MKknwAfa6 58D+Zi4mItxQeJssAXplrZcHq3jkruCVI7L6OK6Gf0cAHzRvdvrj4MjxxA7uDbL47r7d MwcZy/p9BFxml5dZa/KbnYNcieFKrGJV1TL+v55nOQ3ZuddPn9SMq00K2A5hYR+r88zC NkJoGjVe1BW3IOcYsmOxpsHM/Lhkj2fEv+Wk+v1ZOBH0BJqoX/Kn3ia1Yv1iFHr1csuW TFhAGqP1/LdeBLYRf+lk6jBNU/8IAtK9KI4fr4snR5j0x5hUuEpU4DddzHSNXvyc5il6 /lxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hgfCXkhJfVp/8X1tpgYk2fOrnLX6L3/Rp5BNXTcZ3sc=; b=td93aNvNQ7vrVXF24FV1keTQbjR6qv41vq+6AUTUdriaZLMHqUUTTGqm7L1s33UPmL PHm4d7zX0gSXpUVQmZP25WjY0J3tLpIeZWPQrCpUfvO64DnsYaQl3wovkPaLb1R6ANmW DUOPGHFGf3e+nvneXgfaqoLfLEG5ZOvaD8K6J7WbYuED41qCvo0mKuM31sIpqpy6cggh dleuLSrOlDDabOVqt4FMjXRhSIwpi9Y3fiBwBIaGK9rJRyTRlwA4CtUijjoejbw5CjtH T8YozNy/gZdoeTOejWOj/ankI2fchX2DaU+Cw9aEjzqCgVAZHp9LMRthV+C7fPtD2IO1 O3kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ArnlNllK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ay2-20020a1709028b8200b0019e2eb49236si6824693plb.229.2023.04.02.22.20.34; Sun, 02 Apr 2023 22:20:46 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ArnlNllK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231470AbjDCFTH (ORCPT + 99 others); Mon, 3 Apr 2023 01:19:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231491AbjDCFSm (ORCPT ); Mon, 3 Apr 2023 01:18:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA04A5BA9; Sun, 2 Apr 2023 22:18:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A593DB81134; Mon, 3 Apr 2023 05:18:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01D53C433EF; Mon, 3 Apr 2023 05:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680499109; bh=P8j0AzckZVYhGZrPQQ0YU21I6adlzSVHyeBkQuU1TaA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ArnlNllK5+jL5k0N6RXq6IqNSbuKSzUmT07cVkdEF+J969KZc205Y78fIj0Haa4pC d9/PzbvFL3pIK1hAh79zAAyC3i6hB2gOXcCG3+bJ+82zyl3XXUV2VqzFyZxK8fsTPk VBmEUPWtFi5bD/VviCpHeKLGjt2KwMIfWQjr7hSCjEXvWkII6MMSDcABWPLhx0l3v8 WgAtt76Co24WYzs2H75+FsJjYiuuvf0/MlOF21C5IK+fePj/F/8H9RJs2BoZS5ZTQw 7i789aZ47nzCCIuH1tTRZheEPmxAWMoSEjSMn3pYJtf02fMCgNRsrcXAiQ4EUvumlB fV9TNf0Zc074g== Date: Mon, 3 Apr 2023 10:48:24 +0530 From: Manivannan Sadhasivam To: Jeffrey Hugo Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] bus: mhi: host: Use ERANGE for BHIOFF/BHIEOFF range check Message-ID: <20230403051824.GD4627@thinkpad> References: <1679674860-28229-1-git-send-email-quic_jhugo@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1679674860-28229-1-git-send-email-quic_jhugo@quicinc.com> X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 On Fri, Mar 24, 2023 at 10:21:00AM -0600, Jeffrey Hugo wrote: > If the BHIOFF or BHIEOFF range checks fail, they return EINVAL. ERANGE > is a better error code since it implies an out of range condition. > > Suggested-by: Manivannan Sadhasivam > Signed-off-by: Jeffrey Hugo Applied to mhi-next! - Mani > --- > > This feels more like a style change than fixing a bug, so I'm being > conservative and intentionally not listing a fixes tag. > > drivers/bus/mhi/host/init.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c > index b46a082..f72fcb6 100644 > --- a/drivers/bus/mhi/host/init.c > +++ b/drivers/bus/mhi/host/init.c > @@ -1112,7 +1112,7 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl) > if (bhi_off >= mhi_cntrl->reg_len) { > dev_err(dev, "BHI offset: 0x%x is out of range: 0x%zx\n", > bhi_off, mhi_cntrl->reg_len); > - ret = -EINVAL; > + ret = -ERANGE; > goto error_reg_offset; > } > mhi_cntrl->bhi = mhi_cntrl->regs + bhi_off; > @@ -1129,7 +1129,7 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl) > dev_err(dev, > "BHIe offset: 0x%x is out of range: 0x%zx\n", > bhie_off, mhi_cntrl->reg_len); > - ret = -EINVAL; > + ret = -ERANGE; > goto error_reg_offset; > } > mhi_cntrl->bhie = mhi_cntrl->regs + bhie_off; > -- > 2.7.4 > -- மணிவண்ணன் சதாசிவம்