[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201002041910.GB78003@sol.localdomain>
Date: Thu, 1 Oct 2020 21:19:10 -0700
From: Eric Biggers <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 1/2] scsi: ufs: Use memset to initialize variable in
ufshcd_crypto_keyslot_program
On Fri, Oct 02, 2020 at 12:05:17PM +0800, Pujin Shi wrote:
> Clang warns:
>
> drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: missing braces around initializer [-Wmissing-braces]
> union ufs_crypto_cfg_entry cfg = { 0 };
> ^
>
Which version of clang? I don't see the warning with clang 10.0.1
(or with gcc 10.2.0).
> Signed-off-by: Pujin Shi <shipujin.t@...il.com>
> ---
> drivers/scsi/ufs/ufshcd-crypto.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c
> index d2edbd960ebf..8fca2a40c517 100644
> --- a/drivers/scsi/ufs/ufshcd-crypto.c
> +++ b/drivers/scsi/ufs/ufshcd-crypto.c
> @@ -59,9 +59,11 @@ 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;
>
> + memset(&cfg, 0, sizeof(cfg));
> +
How about an empty initializer?
union ufs_crypto_cfg_entry cfg = {};
Same comments on your other patch.
- Eric
Powered by blists - more mailing lists