Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2338448ybl; Sat, 11 Jan 2020 14:52:33 -0800 (PST) X-Google-Smtp-Source: APXvYqzRZFPcGb1QsdcLEVeOELhF0TOSL/avcgIviL2k22vNXTn8IN0VOYs4ITR/lFHv8JruoOEt X-Received: by 2002:a9d:811:: with SMTP id 17mr8348066oty.369.1578783153885; Sat, 11 Jan 2020 14:52:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578783153; cv=none; d=google.com; s=arc-20160816; b=Exe6rIyzASzMyDL8/DT5YIrap2ln7CtFN8jBIJ0stLngQYqpvo7ltTA9jKDaCGj6bY qiXCjWwxrCN1VdKoKjeDxag7X6Cjcs6Le/1WutLKaiVGJ8cgT2TQUrEHr+dxAvVAcnL/ Is5sL+kMN8TEcPryvwD0K60593dBax49cGuy9x4BgJ5VjiSQ6iu+38aEuYF1hqt1hzIJ zfFerGVJhCc+PXFQIIsfogEBV2apW+HlgeAgSNOA9g7m46K3zHS0VINzDpZEBTGmz+A3 W2+SoWIOyBDoCkp7oxiSgZw2qsfaD6jrLNU3YfYdg/4WKSqibKOnmht8Xqke9TCxeJFy WOAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:autocrypt:from:references:cc:to:subject; bh=1Y+eakPpLPu3QpHBaVl40IWgpXF2l/AUF3kqpcxzchk=; b=K/bpUGn7AQD+9aM7vvfpRxPTdkp5beaqNbMYh6y+xrqaDouBhvp6tAAO5g31/gywyZ 4+Bnz8c0eUB1cYCtRoLPpojiJUY1nlZHLgE/WM3lyo+qK3CwUnvtslXPwTZoPTNyHoPl Dv3Ii7VbXzw+0yhz7oVckZRCEcQtP9clgSB5YPzqJjh+77nnYyhpKxN192NB1oECAZpt Q1U+ab92mNh0R0p3ULl++2Gz2H3pwHy1mPIKHX5miXILlDMx4w4ZTW7305q8w77yL3I8 GeyAAiJZRYjmXnZ6yLbkABaJymkXe5AK/L0uZj8+zSTTYdD31Lk87+6yCoqEgeoMgRAh 0hmA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10si3650668oic.153.2020.01.11.14.52.20; Sat, 11 Jan 2020 14:52:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731626AbgAKWuV (ORCPT + 99 others); Sat, 11 Jan 2020 17:50:21 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:45686 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731610AbgAKWuV (ORCPT ); Sat, 11 Jan 2020 17:50:21 -0500 Received: by mail-pl1-f195.google.com with SMTP id b22so2275768pls.12; Sat, 11 Jan 2020 14:50:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=1Y+eakPpLPu3QpHBaVl40IWgpXF2l/AUF3kqpcxzchk=; b=oMu7K7YZpxVwP/ckYBEDYqxAgT+8dS6kHsrpuW17ez1UBhJnf8rF6//ANjTDRrDwhY r2U1tXNG88C+XodsDWICX3F1m1uSXOpbt2WvKxHr8Yin4d/CigLGCbbB9oSfGgJrYr+Q pkyWmlNqKMwY36k9zPSZ8l9JAhB304xmgIojZsLAe3iqH8G4TduxLfDBDdTWx9KGkhUd esz2pSLGz1ONJQW/Je7sdD7NonBw5yXeLZGdr0vvtsseFfml4F2IBPsyshcnwlOSBWor XaPjkDL5TX4EtIKJMOq+D3brWmprhqeBc4q5HvrYrrBnxYVCE1fTFjOvrcP2I5OYXKrm 1iyw== X-Gm-Message-State: APjAAAWNu4CvfiQyVKdusfmM9+y7Y0VW2BPI+mnvsLpn3G5m+45kAyuE UMkSSZ/jZHHUjUNqv81CK/bst6/R X-Received: by 2002:a17:902:968b:: with SMTP id n11mr12109209plp.120.1578783019935; Sat, 11 Jan 2020 14:50:19 -0800 (PST) Received: from ?IPv6:2601:647:4000:d7:7c72:26f5:20:bf58? ([2601:647:4000:d7:7c72:26f5:20:bf58]) by smtp.gmail.com with ESMTPSA id d3sm7419410pjx.16.2020.01.11.14.50.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 11 Jan 2020 14:50:19 -0800 (PST) Subject: Re: [PATCH 3/3] scsi: ufs: use UFS device indicated maximum LU number To: Bean Huo , alim.akhtar@samsung.com, avri.altman@wdc.com, pedrom.sousa@synopsys.com, jejb@linux.ibm.com, martin.petersen@oracle.com, stanley.chu@mediatek.com, beanhuo@micron.com, tomas.winkler@intel.com, cang@codeaurora.org Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <20200110183606.10102-1-huobean@gmail.com> <20200110183606.10102-4-huobean@gmail.com> From: Bart Van Assche Autocrypt: addr=bvanassche@acm.org; prefer-encrypt=mutual; keydata= mQENBFSOu4oBCADcRWxVUvkkvRmmwTwIjIJvZOu6wNm+dz5AF4z0FHW2KNZL3oheO3P8UZWr LQOrCfRcK8e/sIs2Y2D3Lg/SL7qqbMehGEYcJptu6mKkywBfoYbtBkVoJ/jQsi2H0vBiiCOy fmxMHIPcYxaJdXxrOG2UO4B60Y/BzE6OrPDT44w4cZA9DH5xialliWU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alUfn5XU0RQDYdwp6/kMEXMdmT oH0F0xB3SQ8WVSXA9rrc4EBvZruWQ+5/zjVrhhfUAx12CzL4oQ9Ro2k45daYaonKTANYG22y //x8dLe2Fv1By4SKGhmzwH87uXxbTJAUxiWIi1np0z3/RDnoVyfmfbbL1DY7zf2hYXLLzsJR mSsED/1nlJ9Oq5fALdNEPgDyPUerqHxcmIub+pF0AzJoYHK5punqpqfGmqPbjxrJLPJfHVKy goMj5DlBMoYqEgpbwdUYkH6QdizJJCur4icy8GUNbisFYABeoJ91pnD4IGei3MTdvINSZI5e Message-ID: <9f26bde7-0c78-c56c-4f15-5bf2dba71506@acm.org> Date: Sat, 11 Jan 2020 14:50:17 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <20200110183606.10102-4-huobean@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-01-10 10:36, Bean Huo wrote: > @@ -548,12 +547,19 @@ struct ufs_dev_desc { > > /** > * ufs_is_valid_unit_desc_lun - checks if the given LUN has a unit descriptor > + * @dev_info: pointer of instance of struct ufs_dev_info > * @lun: LU number to check > * @return: true if the lun has a matching unit descriptor, false otherwise > */ > -static inline bool ufs_is_valid_unit_desc_lun(u8 lun) > +static inline bool ufs_is_valid_unit_desc_lun(struct ufs_dev_info *dev_info, > + u8 lun) > { Can the dev_info be declared 'const' (const truct ufs_dev_info *dev_info)? > - return lun == UFS_UPIU_RPMB_WLUN || (lun < UFS_UPIU_MAX_GENERAL_LUN); > + if (!dev_info || !dev_info->max_lu_supported) { > + pr_err("Max General LU supported by UFS isn't initilized\n"); ^^^^^^^^^^ initialized? > + return false; > + } > + > + return lun == UFS_UPIU_RPMB_WLUN || (lun < dev_info->max_lu_supported); > } Are the parentheses in the above expression necessary? Thanks, Bart.