All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] scsi: ufs: fix missing brace warning for old compilers
@ 2020-10-02  6:35 Pujin Shi
  2020-10-02 17:09 ` ebiggers
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pujin Shi @ 2020-10-02  6:35 UTC (permalink / raw)
  To: James E . J . Bottomley, Martin K . Petersen
  Cc: Alim Akhtar, Avri Altman, Eric Biggers, Satya Tangirala,
	Stanley Chu, linux-scsi, linux-kernel, hankinsea, shipujin.t

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@gmail.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 = {};
 
 	return ufshcd_program_key(hba, &cfg, slot);
 }
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] scsi: ufs: fix missing brace warning for old compilers
  2020-10-02  6:35 [PATCH v2] scsi: ufs: fix missing brace warning for old compilers Pujin Shi
@ 2020-10-02 17:09 ` ebiggers
  2020-10-02 23:13 ` Martin K. Petersen
  2020-10-07  3:48 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: ebiggers @ 2020-10-02 17:09 UTC (permalink / raw)
  To: Pujin Shi
  Cc: James E . J . Bottomley, Martin K . Petersen, Alim Akhtar,
	Avri Altman, Satya Tangirala, Stanley Chu, linux-scsi,
	linux-kernel, hankinsea

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@gmail.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@google.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] scsi: ufs: fix missing brace warning for old compilers
  2020-10-02  6:35 [PATCH v2] scsi: ufs: fix missing brace warning for old compilers Pujin Shi
  2020-10-02 17:09 ` ebiggers
@ 2020-10-02 23:13 ` Martin K. Petersen
  2020-10-07  3:48 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-10-02 23:13 UTC (permalink / raw)
  To: Pujin Shi
  Cc: James E . J . Bottomley, Martin K . Petersen, Alim Akhtar,
	Avri Altman, Eric Biggers, Satya Tangirala, Stanley Chu,
	linux-scsi, linux-kernel, hankinsea


Pujin,

> 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

Applied to 5.10/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] scsi: ufs: fix missing brace warning for old compilers
  2020-10-02  6:35 [PATCH v2] scsi: ufs: fix missing brace warning for old compilers Pujin Shi
  2020-10-02 17:09 ` ebiggers
  2020-10-02 23:13 ` Martin K. Petersen
@ 2020-10-07  3:48 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-10-07  3:48 UTC (permalink / raw)
  To: James E . J . Bottomley, Pujin Shi
  Cc: Martin K . Petersen, Satya Tangirala, Stanley Chu, linux-scsi,
	Eric Biggers, linux-kernel, hankinsea, Alim Akhtar, Avri Altman

On Fri, 2 Oct 2020 14:35:38 +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

Applied to 5.10/scsi-queue, thanks!

[1/1] scsi: ufs: Fix missing brace warning for old compilers
      https://git.kernel.org/mkp/scsi/c/6500251e5906

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-07  3:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02  6:35 [PATCH v2] scsi: ufs: fix missing brace warning for old compilers Pujin Shi
2020-10-02 17:09 ` ebiggers
2020-10-02 23:13 ` Martin K. Petersen
2020-10-07  3:48 ` Martin K. Petersen

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.