Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4069967rwl; Sun, 2 Apr 2023 22:19:35 -0700 (PDT) X-Google-Smtp-Source: AKy350ZY90n00JM9sAZDmye2wbhXb0DjvKb7LT0n53rHmflXsHyVDZX4XhowQ/V9a4t1ZIt1jRxt X-Received: by 2002:a62:3041:0:b0:627:ee6a:2a40 with SMTP id w62-20020a623041000000b00627ee6a2a40mr33067823pfw.10.1680499175543; Sun, 02 Apr 2023 22:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680499175; cv=none; d=google.com; s=arc-20160816; b=KuWrLeG09eoM6LcxIexc9xtaUahr4DECqZ4tFp6op9ii7PHHqRzYlI98yQOzCsg5Wb F/mD8n5waFNUzwK1ZbLeCrh8RqgCcrBjXPIl6V4LbxqiSlgShIBMC8dEm7bFIVV5Q0sQ O09GqXwsAdpXsiKatqO1MA77WtRzoefAoRg8PfGEkGYd7N0YRje0e96um/SJQR57Gtdf yBSTEIjIqafkdb0NKdYUa4Mee09Jj0RUK1UeScN/7XsCaqUEyJRo/HmxoV8CkOT4c+X8 Ob1sUxMCDh14cJPRxj22PM/Sl4P4HHdUG/hnMLg8nnYfZ07HdyTmsvlWw3gfKj2T8f98 ulLg== 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=UquNmcK0KQARDfSwXZWna+D6uGNyCE5HbKLnzl3xZmY=; b=iRnnZFwSPB/8YSVLBio0nzItJ3tlcTxXiC4nhY02Mrt+u+VvnfNf/+8KFZ48nDlg+z Sk9GvP9ulJBMDptfBV+0rVEFtR9rjZj5kEnapiIOtrltq+kboBnrcQ2wSljrIsRbZNZk DtgHr76gFTTqT8qXfU42f04EQto1le7GbnIqw/DfV9OsVkE7cPXTi55a7LOHRbMDmdkm AQkAprEzkLiQ322wO4erzhr2U5a8TzK2SZjK0YAuaH1HyFPNEN6jXzCfrmltbO/QYxkK av8jzUjeCE3QnrQ+krQ3oPqRKK/NHpucqv8VQLbxT/PYJUMFPEoZBcevpyJr+06z5yPW Vgaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XjB+HVnP; 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 y10-20020aa793ca000000b0061da3291168si7475373pff.36.2023.04.02.22.19.24; Sun, 02 Apr 2023 22:19:35 -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=XjB+HVnP; 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 S231437AbjDCFSF (ORCPT + 99 others); Mon, 3 Apr 2023 01:18:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbjDCFSE (ORCPT ); Mon, 3 Apr 2023 01:18:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D81955A7; Sun, 2 Apr 2023 22:18:03 -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 dfw.source.kernel.org (Postfix) with ESMTPS id BC529614AC; Mon, 3 Apr 2023 05:18:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD540C433D2; Mon, 3 Apr 2023 05:18:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680499082; bh=Ry7b3/8RKxj+1luWeOjO0avmB+5u5dLjGt3zcnvaVn4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XjB+HVnPEgcwhnLAcYDTS25EspHJqwb5NR3ehZXCyNHLNOpnm86IVK9dzLlZkAU88 4DkXuvE7Ncr5avdB8aYtmwPbfJgRKnJXkrKRimeBT16J25XmbHSkZKXyH/NOvK+pRc FJfWCkxY7olQKKpu44eOUcpVI3onDC5hs1Hb6N2KwtMt9slk/eiqP+FU8IuvFy3lKX /A0/nq4zGBEMwK2hYDcBI58CfFq0+kS7r0LL6BAIFoVNF8iU7u6PiQUonHIaF/t7Ga 6T4toYalOS+z4N81wlUHC4NmGbcKA3lp+mOfcB1mhnmH9DBPV/oWCvAYn2ZE5SbIhi 4ehYlLfrJw86w== Date: Mon, 3 Apr 2023 10:47:57 +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: <20230403051757.GC4627@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 - 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 > -- மணிவண்ணன் சதாசிவம்