[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201002170915.GA2119452@gmail.com>
Date: Fri, 2 Oct 2020 10:09:15 -0700
From: ebiggers@...nel.org
To: Pujin Shi <shipujin.t@...il.com>
Cc: "James E . J . Bottomley" <jejb@...ux.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
Satya Tangirala <satyat@...gle.com>,
Stanley Chu <stanley.chu@...iatek.com>,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
hankinsea@...il.com
Subject: Re: [PATCH v2] scsi: ufs: fix missing brace warning for old compilers
On Fri, Oct 02, 2020 at 02:35:38PM +0800, Pujin Shi wrote:
> For older versions of gcc, the array = {0}; will cause warnings:
>
> drivers/scsi/ufs/ufshcd-crypto.c: In function 'ufshcd_crypto_keyslot_program':
> drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: missing braces around initializer [-Wmissing-braces]
> union ufs_crypto_cfg_entry cfg = { 0 };
> ^
> drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: (near initialization for 'cfg.reg_val') [-Wmissing-braces]
> drivers/scsi/ufs/ufshcd-crypto.c: In function 'ufshcd_clear_keyslot':
> drivers/scsi/ufs/ufshcd-crypto.c:103:8: warning: missing braces around initializer [-Wmissing-braces]
> union ufs_crypto_cfg_entry cfg = { 0 };
> ^
> 2 warnings generated
>
> Fixes: 70297a8ac7a7 ("scsi: ufs: UFS crypto API")
> Signed-off-by: Pujin Shi <shipujin.t@...il.com>
> ---
> drivers/scsi/ufs/ufshcd-crypto.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c
> index d2edbd960ebf..07310b12a5dc 100644
> --- a/drivers/scsi/ufs/ufshcd-crypto.c
> +++ b/drivers/scsi/ufs/ufshcd-crypto.c
> @@ -59,7 +59,7 @@ static int ufshcd_crypto_keyslot_program(struct blk_keyslot_manager *ksm,
> u8 data_unit_mask = key->crypto_cfg.data_unit_size / 512;
> int i;
> int cap_idx = -1;
> - union ufs_crypto_cfg_entry cfg = { 0 };
> + union ufs_crypto_cfg_entry cfg = {};
> int err;
>
> BUILD_BUG_ON(UFS_CRYPTO_KEY_SIZE_INVALID != 0);
> @@ -100,7 +100,7 @@ static int ufshcd_clear_keyslot(struct ufs_hba *hba, int slot)
> * Clear the crypto cfg on the device. Clearing CFGE
> * might not be sufficient, so just clear the entire cfg.
> */
> - union ufs_crypto_cfg_entry cfg = { 0 };
> + union ufs_crypto_cfg_entry cfg = {};
>
Looks good,
Reviewed-by: Eric Biggers <ebiggers@...gle.com>
Powered by blists - more mailing lists