All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: drivers/scsi/ufs/ufshcd-crypto.c:160 ufshcd_hba_init_crypto_capabilities() warn: missing error code 'err'
Date: Sat, 24 Apr 2021 06:00:46 +0800	[thread overview]
Message-ID: <202104240643.ueDTYAxC-lkp@intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 6901 bytes --]

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Satya Tangirala <satyat@google.com>
CC: "Martin K. Petersen" <martin.petersen@oracle.com>
CC: Eric Biggers <ebiggers@google.com>
CC: Stanley Chu <stanley.chu@mediatek.com>
CC: Alim Akhtar <alim.akhtar@samsung.com>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   5bfc75d92efd494db37f5c4c173d3639d4772966
commit: 70297a8ac7a7a4a3284c2eb20fefefbe72dab338 scsi: ufs: UFS crypto API
date:   10 months ago
:::::: branch date: 5 hours ago
:::::: commit date: 10 months ago
config: x86_64-randconfig-m001-20210424 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/scsi/ufs/ufshcd-crypto.c:160 ufshcd_hba_init_crypto_capabilities() warn: missing error code 'err'

vim +/err +160 drivers/scsi/ufs/ufshcd-crypto.c

70297a8ac7a7a4 Satya Tangirala 2020-07-06  139  
70297a8ac7a7a4 Satya Tangirala 2020-07-06  140  /**
70297a8ac7a7a4 Satya Tangirala 2020-07-06  141   * ufshcd_hba_init_crypto_capabilities - Read crypto capabilities, init crypto
70297a8ac7a7a4 Satya Tangirala 2020-07-06  142   *					 fields in hba
70297a8ac7a7a4 Satya Tangirala 2020-07-06  143   * @hba: Per adapter instance
70297a8ac7a7a4 Satya Tangirala 2020-07-06  144   *
70297a8ac7a7a4 Satya Tangirala 2020-07-06  145   * Return: 0 if crypto was initialized or is not supported, else a -errno value.
70297a8ac7a7a4 Satya Tangirala 2020-07-06  146   */
70297a8ac7a7a4 Satya Tangirala 2020-07-06  147  int ufshcd_hba_init_crypto_capabilities(struct ufs_hba *hba)
70297a8ac7a7a4 Satya Tangirala 2020-07-06  148  {
70297a8ac7a7a4 Satya Tangirala 2020-07-06  149  	int cap_idx;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  150  	int err = 0;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  151  	enum blk_crypto_mode_num blk_mode_num;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  152  
70297a8ac7a7a4 Satya Tangirala 2020-07-06  153  	/*
70297a8ac7a7a4 Satya Tangirala 2020-07-06  154  	 * Don't use crypto if either the hardware doesn't advertise the
70297a8ac7a7a4 Satya Tangirala 2020-07-06  155  	 * standard crypto capability bit *or* if the vendor specific driver
70297a8ac7a7a4 Satya Tangirala 2020-07-06  156  	 * hasn't advertised that crypto is supported.
70297a8ac7a7a4 Satya Tangirala 2020-07-06  157  	 */
70297a8ac7a7a4 Satya Tangirala 2020-07-06  158  	if (!(hba->capabilities & MASK_CRYPTO_SUPPORT) ||
70297a8ac7a7a4 Satya Tangirala 2020-07-06  159  	    !(hba->caps & UFSHCD_CAP_CRYPTO))
70297a8ac7a7a4 Satya Tangirala 2020-07-06 @160  		goto out;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  161  
70297a8ac7a7a4 Satya Tangirala 2020-07-06  162  	hba->crypto_capabilities.reg_val =
70297a8ac7a7a4 Satya Tangirala 2020-07-06  163  			cpu_to_le32(ufshcd_readl(hba, REG_UFS_CCAP));
70297a8ac7a7a4 Satya Tangirala 2020-07-06  164  	hba->crypto_cfg_register =
70297a8ac7a7a4 Satya Tangirala 2020-07-06  165  		(u32)hba->crypto_capabilities.config_array_ptr * 0x100;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  166  	hba->crypto_cap_array =
70297a8ac7a7a4 Satya Tangirala 2020-07-06  167  		devm_kcalloc(hba->dev, hba->crypto_capabilities.num_crypto_cap,
70297a8ac7a7a4 Satya Tangirala 2020-07-06  168  			     sizeof(hba->crypto_cap_array[0]), GFP_KERNEL);
70297a8ac7a7a4 Satya Tangirala 2020-07-06  169  	if (!hba->crypto_cap_array) {
70297a8ac7a7a4 Satya Tangirala 2020-07-06  170  		err = -ENOMEM;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  171  		goto out;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  172  	}
70297a8ac7a7a4 Satya Tangirala 2020-07-06  173  
70297a8ac7a7a4 Satya Tangirala 2020-07-06  174  	/* The actual number of configurations supported is (CFGC+1) */
70297a8ac7a7a4 Satya Tangirala 2020-07-06  175  	err = blk_ksm_init(&hba->ksm,
70297a8ac7a7a4 Satya Tangirala 2020-07-06  176  			   hba->crypto_capabilities.config_count + 1);
70297a8ac7a7a4 Satya Tangirala 2020-07-06  177  	if (err)
70297a8ac7a7a4 Satya Tangirala 2020-07-06  178  		goto out_free_caps;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  179  
70297a8ac7a7a4 Satya Tangirala 2020-07-06  180  	hba->ksm.ksm_ll_ops = ufshcd_ksm_ops;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  181  	/* UFS only supports 8 bytes for any DUN */
70297a8ac7a7a4 Satya Tangirala 2020-07-06  182  	hba->ksm.max_dun_bytes_supported = 8;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  183  	hba->ksm.dev = hba->dev;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  184  
70297a8ac7a7a4 Satya Tangirala 2020-07-06  185  	/*
70297a8ac7a7a4 Satya Tangirala 2020-07-06  186  	 * Cache all the UFS crypto capabilities and advertise the supported
70297a8ac7a7a4 Satya Tangirala 2020-07-06  187  	 * crypto modes and data unit sizes to the block layer.
70297a8ac7a7a4 Satya Tangirala 2020-07-06  188  	 */
70297a8ac7a7a4 Satya Tangirala 2020-07-06  189  	for (cap_idx = 0; cap_idx < hba->crypto_capabilities.num_crypto_cap;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  190  	     cap_idx++) {
70297a8ac7a7a4 Satya Tangirala 2020-07-06  191  		hba->crypto_cap_array[cap_idx].reg_val =
70297a8ac7a7a4 Satya Tangirala 2020-07-06  192  			cpu_to_le32(ufshcd_readl(hba,
70297a8ac7a7a4 Satya Tangirala 2020-07-06  193  						 REG_UFS_CRYPTOCAP +
70297a8ac7a7a4 Satya Tangirala 2020-07-06  194  						 cap_idx * sizeof(__le32)));
70297a8ac7a7a4 Satya Tangirala 2020-07-06  195  		blk_mode_num = ufshcd_find_blk_crypto_mode(
70297a8ac7a7a4 Satya Tangirala 2020-07-06  196  						hba->crypto_cap_array[cap_idx]);
70297a8ac7a7a4 Satya Tangirala 2020-07-06  197  		if (blk_mode_num != BLK_ENCRYPTION_MODE_INVALID)
70297a8ac7a7a4 Satya Tangirala 2020-07-06  198  			hba->ksm.crypto_modes_supported[blk_mode_num] |=
70297a8ac7a7a4 Satya Tangirala 2020-07-06  199  				hba->crypto_cap_array[cap_idx].sdus_mask * 512;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  200  	}
70297a8ac7a7a4 Satya Tangirala 2020-07-06  201  
70297a8ac7a7a4 Satya Tangirala 2020-07-06  202  	return 0;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  203  
70297a8ac7a7a4 Satya Tangirala 2020-07-06  204  out_free_caps:
70297a8ac7a7a4 Satya Tangirala 2020-07-06  205  	devm_kfree(hba->dev, hba->crypto_cap_array);
70297a8ac7a7a4 Satya Tangirala 2020-07-06  206  out:
70297a8ac7a7a4 Satya Tangirala 2020-07-06  207  	/* Indicate that init failed by clearing UFSHCD_CAP_CRYPTO */
70297a8ac7a7a4 Satya Tangirala 2020-07-06  208  	hba->caps &= ~UFSHCD_CAP_CRYPTO;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  209  	return err;
70297a8ac7a7a4 Satya Tangirala 2020-07-06  210  }
70297a8ac7a7a4 Satya Tangirala 2020-07-06  211  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 28800 bytes --]

                 reply	other threads:[~2021-04-23 22:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202104240643.ueDTYAxC-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=kbuild@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.