Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2653619rwl; Mon, 27 Mar 2023 03:26:44 -0700 (PDT) X-Google-Smtp-Source: AKy350Yux+gOP6to+eQca8fq2LweeNcxe4bJ1A3XnqJETxgt9/9KTAEQUvEsUjDntvEOm1Lous1Y X-Received: by 2002:a05:6a20:cf54:b0:de:c8eb:5e1d with SMTP id hz20-20020a056a20cf5400b000dec8eb5e1dmr6577124pzb.24.1679912804562; Mon, 27 Mar 2023 03:26:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679912804; cv=none; d=google.com; s=arc-20160816; b=pMM0Qop+yIUH16qAhg4hc04unw5sxFoRinmKWmy3uU6UTq43HBVjy5FhN7ud92p0Pw IinYchBnS7WaK3ff1SdNHq950q1hTcd8hIv0nEoPx0Q/YWkCfVlgle+794hEHP0iMEw3 ufipjmKpm47o08Qw0EKjbFv8g1REWlEXAmA1NjY9RYt0etGW+VwtN4hJ2Bfu0xeRGf1M P28W+Aik68sNfADF9g40qHGXrhKPvsVpcN5Sh8ao0gzuED34V6B5kSILMvkhHRGR3euF uJjdDvqZ48gub5Ph5oIRHcyvCczCvFy2NBOZpFnSMuCrdsIE1ZthNupvcCF4oef19bag M75g== 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=pCxeve9wGtgIHYeLmFeN7r+/KkuRJmye3rtIjC7+mDA=; b=P8wF+NgNbGb0NIvXrd1aC1R7C3a60N/QJnlVwMUn2DZxYTjzGvw95xkqNWKvUAjEq/ P8SpfedWoHC78Kw2DAKdLDjKRYylgG5LFxP+QrgVwqJR8CxjyznTcws0sMK5wjbVxDfb B9OFH8NvS4/QzO5cLIybVP5/SPouZ2GCU52X05C8yH5VkLiq/arfYoSbffiSdKgBGIbT r9IsafgUR4r6GbF9u8HNoYXH5zplPd9IsHcw/j2VxREOzjDmJ2V7DAM5P6mEI5uW5rNT 72Y9gl1ghUR3qgLXCDmtfnZaZOEcnXiwF6aORb809rQdHuHNEHLItCN/Sw020j9GQ2rv RA5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ByNXDIp1; 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 202-20020a6301d3000000b0050bf890f8b9si26074544pgb.613.2023.03.27.03.26.32; Mon, 27 Mar 2023 03:26:44 -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=ByNXDIp1; 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 S233003AbjC0KYX (ORCPT + 99 others); Mon, 27 Mar 2023 06:24:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233510AbjC0KYP (ORCPT ); Mon, 27 Mar 2023 06:24:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA9D95584; Mon, 27 Mar 2023 03:24:12 -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 812F9B80EAC; Mon, 27 Mar 2023 10:24:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60DDAC433D2; Mon, 27 Mar 2023 10:24:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679912650; bh=hcQE71Jvx8KIyqm7WTbycXq2YmJt3VrPaHDQ+soP+t8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ByNXDIp1IsDxJc902OilRAg5Kz+6s2qF1EUalQPyHqIC5vJhNHk8Wg9EUd8a2OwAt l75zb3zgsMRrzLR1azq24o2dlRYXLamzsIHOmG5wuT/DQioCEuNvcUU8rteZ8BO9wE sg91VzCWrqqWyT7sjYNoD9J21G3TvtQkPOecuz5k82WywAA319o7sHqmMNLN/7f9Iy Kdjmj0q+/oyNHVK1odjwfc4B0MeJC1LKDxN4pK7v12Lp9gJ/zdtmxXadbySekktqOl l9ET+OhVYJnJKRBeka4++syR2XBbfGxQtUvFyKFwshkmbDSdxlc2QWuM/Ny8Tj6h3u yGfyX8Lc4uYaw== Date: Mon, 27 Mar 2023 15:53:58 +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: <20230327102358.GD16424@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=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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 Reviewed-by: Manivannan Sadhasivam Thanks, 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 > > -- மணிவண்ணன் சதாசிவம்