From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 642173F99C9 for ; Tue, 24 Mar 2026 12:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774355574; cv=none; b=kq1P35NIKHd3RnwHotbxgs1UN+9Xlc9i6/DCo8NwwtKTTf2L0oSfAk3or9ihX48wyF0o2w+fDfq/pxiTCRN4g2E6JKmyZuZHEiqXCHmFReVeU6eaFopLrP2D0Iu5JcmhNrGB6vGrUW0M2fDCsys7tB2AYQiUTsrt/QPgA6PYzbU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774355574; c=relaxed/simple; bh=K+62/RY1VqDt8d7ZbBqBcK+vgSO+rSU5Shy+fhN5Djs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sKag7r/zp1HUihnFDo5fDLpB/9oOKrEe4J/0E/63rpd+LPcvJx5sxE+tGTkclLtpAWGvUUJNTaxvtRITAvJRyON6M+3ASXOZ09mwJRyubrhDLeNusYn5QIX9tMtwr2O50/8FWcSkqxydfVgIq5UAvMSFY30cen/HRL8Repxj1Ik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=J2KjtTBR; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=RVSsXbnE; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="J2KjtTBR"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RVSsXbnE" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 62OBbfYn1293060 for ; Tue, 24 Mar 2026 12:32:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= SFSY807vxOyGgTezoYLzQbN/077d0T02CNYv84Cish4=; b=J2KjtTBRra5gAVm5 eissekn4TC5/MK4BRy00pqXUARBbM8QYwLHOkyxIbSios7VXxnnxHPZ3i1pRwm2K PQZff4y3+RPEe9ht7zBOb0tgJUOHy7pD8ESpAyOXVgdMPFri9S6Z70abOnRLQXtt Qel8A81Mi2StWqoyrf4+5G5eKTY+AkpG+FneMsoK4Bs2Xp6StI58KFpBCMYAcZrk dHLv9P33fN7nLJLK0TsXyg+WFFgFYBhQDfX0K1XggVNN8qPV3c2lK45CUIrikLzM ViNUPalLvVB1hQ/Fqjf/u0KVgigdkLVrTSv7qAXITp0ozE2wnuGLwtemAIQevTIH 86BQZw== Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4d3sw408wb-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 24 Mar 2026 12:32:50 +0000 (GMT) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-2adef9d486bso42350685ad.2 for ; Tue, 24 Mar 2026 05:32:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1774355570; x=1774960370; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SFSY807vxOyGgTezoYLzQbN/077d0T02CNYv84Cish4=; b=RVSsXbnE6UML1g8S9yd/Ed0BGwMs610svkkkD48ooWM4vv3QCpuZIamK/iUFUMTzgX 9RqyRtW2ZR8D/88Jfu9CXsJS9MOenYBZdZXV2RGS6oXnWauZYInw9UOFU75FoTCa6W+e grb5/Pek+KOxsYUBSqqvu+lJ3GYNMa0psD2lFeOS/YyZzi6J5bMOrKFZhtORES3ApjZm IOewUOl/YbjPtp/v/VwX/6NKjtO8FN9E6ECokO/5g/aB1s0TF5CfPo+4wWECwpl6U6sZ idxFx1F7PTnhf2NHujjWetwYWrKahIbFUT+Orri/0iBwCPJeu03k1+B50p+j5Gb+Ir2y MHbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774355570; x=1774960370; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SFSY807vxOyGgTezoYLzQbN/077d0T02CNYv84Cish4=; b=PLqXQSnU81N7GEV8nw775lC374v7sMIITinQBxL/BnzUxOL4wlnwnvA7B4U5o+0IHp wll+RV7P45eUia3lRp2jMTA4VueamYuwvEtm68mO6TugFDG+b7dT5PH1NKmd7dcF1nXX AKLW05jSYLcNjF7epRO713ADwY0lfRLYXmFF67ebytgw2gBbeN19PFGMqcv64dYC+FsK QV929tvaO4d/1L+zBDq1/5LGZCu2wiXpbi9t7YEg/4kgJYC/povDHHNzm5pQqV8UQ3cH mwvjt4gK+oDQJ4m0N8NsS22tkimwTHCiL3ozfOzT36SgDUpXRo5RQlI31DrcQ3tTfh77 xNyw== X-Forwarded-Encrypted: i=1; AJvYcCVxFrgo83/b31msIxhMD9y44t07zVOVYbXqTK7r74JNkvXB2PM9sPLIcXC6BDwU8AhQDKoIZGG87+sdQ8M=@vger.kernel.org X-Gm-Message-State: AOJu0Yyytrm1Q/zfW/hVcW503N4VkT7XeuqrkajoDs8dLBLR0gMDaBkk 6hUzC4v4APOHIo4uOfCZN04fHwpK4zpgmK94vl8rNNvfBqywsdedrVBFzcpybwI3Ve98bONb9pj 7g/Kn02oWhUPr74C12sqJGu9x9XwIlfnZfXxtqu4ZP22y09j/aN1c49R1yct32NjI0pQ= X-Gm-Gg: ATEYQzwdzoovaj4yIGyf7dZG1gkWga/uLO8wAjexZgsUCG5PvXRHyTqHxSuanmTe0BN eBrKetRKCTkZ61BnGonjKEsPsKu0UPqGbbCdOKdJ7lq9z4iQMbx4/sqDMV8hae6j+u0vtZrz7qD qoGcNAWWgXCo1IuxBH52FMJvnCc75HIy909v07U3y41QzjUpDc8R5m142COT3QGwroo5E3015eo 8xuHZKIMGTAJ4b5fh3LmIitUXyEj3Jbri+JHJGmSxetIb2JsVWZ9+lxgW9ThSSCDhLvDpHNuHzI B3ERuvSZ/2ZfLq/ncYHU5kDMU7DkrRi0aa8wpAnbDobGrEMFignTiYC+0u1siWT97aHuB8U8RrF 8fII/M/kkQScnTCtyliTf2zcTK4hs3wViAR0laR4Iu3aiA3rFHeE7kd3gbHEfnHZyWqMEPVj8mC tj62H5xrGcsWk= X-Received: by 2002:a17:903:b0e:b0:2b0:4b3a:9b49 with SMTP id d9443c01a7336-2b082820d55mr143990515ad.51.1774355569555; Tue, 24 Mar 2026 05:32:49 -0700 (PDT) X-Received: by 2002:a17:903:b0e:b0:2b0:4b3a:9b49 with SMTP id d9443c01a7336-2b082820d55mr143990185ad.51.1774355569032; Tue, 24 Mar 2026 05:32:49 -0700 (PDT) Received: from [10.133.33.145] (tpe-colo-wan-fw-bordernet.qualcomm.com. [103.229.16.4]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0af3008eesm1053265ad.67.2026.03.24.05.32.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Mar 2026 05:32:48 -0700 (PDT) Message-ID: <3913b65a-85da-4951-a3a1-1316f4e9e9bd@oss.qualcomm.com> Date: Tue, 24 Mar 2026 20:32:39 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 04/12] scsi: ufs: core: Add support for TX Equalization To: =?UTF-8?B?UGV0ZXIgV2FuZyAo546L5L+h5Y+LKQ==?= , "beanhuo@micron.com" , "mani@kernel.org" , "avri.altman@wdc.com" , "bvanassche@acm.org" , "martin.petersen@oracle.com" Cc: "linux-scsi@vger.kernel.org" , "adrian.hunter@intel.com" , "alim.akhtar@samsung.com" , "James.Bottomley@HansenPartnership.com" , "quic_nguyenb@quicinc.com" , "linux-kernel@vger.kernel.org" References: <20260321031021.1722459-1-can.guo@oss.qualcomm.com> <20260321031021.1722459-5-can.guo@oss.qualcomm.com> <1a038159-c847-4e58-a60c-cd5ecabeeed9@oss.qualcomm.com> <67dbc2869e68a29d5eed452f0db74acd2021c3e3.camel@mediatek.com> Content-Language: en-US From: Can Guo In-Reply-To: <67dbc2869e68a29d5eed452f0db74acd2021c3e3.camel@mediatek.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzI0MDA5OSBTYWx0ZWRfX5cqMK4MLLdFo 4Pc3ptqZ2v02uArPEn7FPBmca+rdgEy2Tw2yw5MZ04lakb0juOcT+V2zTUWQgu7QQCz99nzcv+9 DjW5iJ6IJtSop9LPFwdjsYfMhWCk5jvnO435DsPOBMFqmvIZ5Qkypw64bap1lO1i/ktu8yDpMk5 foA5lMDsRYAiHXcLQZdroSlj48k/WM8zdAu9GjGtzZDfr92fOQKit7ZpFIqVegrMZjnET1Gi99X lNIV9LTQIZVOgv+7Oi1fTyHgzeMVtP9lRUrgOiCkR90pb406TiAMxr7WmT9fypvTdSbxb+ERNiB MYrHZj/jLairotYVmCMxNW5a7V0NPNC3bC+wKHMci6aHdNp4Uo9ztDcLa6disAM+Nm5u9ATqMCM muFr2hphVQ43pAci1TcPpd5AjwGMnMcnFBQrfuGpaltmS+NTXJNVcaRHHhUUdSFDPHrR+p23Kht dGir9+9UmbOWX6WnNQw== X-Proofpoint-GUID: I8ICJmIreDLgR_Gf8mzNUKjaEjwKAwBl X-Authority-Analysis: v=2.4 cv=bpVBxUai c=1 sm=1 tr=0 ts=69c28472 cx=c_pps a=MTSHoo12Qbhz2p7MsH1ifg==:117 a=nuhDOHQX5FNHPW3J6Bj6AA==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=3WHJM1ZQz_JShphwDgj5:22 a=lZOxv685zBznO1DyOMIA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=GvdueXVYPmCkWapjIL-Q:22 X-Proofpoint-ORIG-GUID: I8ICJmIreDLgR_Gf8mzNUKjaEjwKAwBl X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-24_02,2026-03-23_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 priorityscore=1501 malwarescore=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603240099 On 3/24/2026 7:54 PM, Peter Wang (王信友) wrote: > > On Tue, 2026-03-24 at 18:09 +0800, Can Guo wrote: > > > > +       params = &hba->tx_eq_params[gear - 1]; > > > > + > > > > +       if (gear < UFS_HS_G1 || gear > UFS_HS_GEAR_MAX) { > > > > +               dev_err(hba->dev, "Invalid HS-Gear (%u) for TX > > > > Equalization\n", > > > > +                       gear); > > > > +               return -EINVAL; > > > > +       } else if (gear < adaptive_txeq_gear) { > > > > +               return 0; > > > > +       } > > > > > > > > > > "gear" should be checked before use? > > I don't understand this comment. > > > > Hi Can, > > I mean that gear is used here: > params = &hba->tx_eq_params[gear - 1]; > If gear is 0, it could be dangerous if params is used. > > Therefore, we should move this line after the following check: > if (gear < UFS_HS_G1 || gear > UFS_HS_GEAR_MAX) { > ... > } You are right... Let me address it in next version. Thanks, Can Guo. > > Thanks. > Peter > > > ************* MEDIATEK Confidentiality Notice ******************** > The information contained in this e-mail message (including any > attachments) may be confidential, proprietary, privileged, or otherwise > exempt from disclosure under applicable laws. It is intended to be > conveyed only to the designated recipient(s). Any use, dissemination, > distribution, printing, retaining or copying of this e-mail (including its > attachments) by unintended recipient(s) is strictly prohibited and may > be unlawful. If you are not an intended recipient of this e-mail, or believe > that you have received this e-mail in error, please notify the sender > immediately (by replying to this e-mail), delete any and all copies of > this e-mail (including any attachments) from your system, and do not > disclose the content of this e-mail to any other person. Thank you!