Re: [PATCH] drm/amdgpu: Fix do not add new typedefs in amdgpu_fw_attestation.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 21, 2023 at 4:17 AM Srinivasan Shanmugam
<srinivasan.shanmugam@xxxxxxx> wrote:
>
> Fixes the following to align to coding style:
>
> WARNING: do not add new typedefs
> +typedef struct FW_ATT_DB_HEADER
>
> WARNING: do not add new typedefs
> +typedef struct FW_ATT_RECORD
>
> WARNING: Symbolic permissions 'S_IRUSR' are not preferred. Consider using octal permissions '0400'.
> +                           S_IRUSR,
>
> ERROR: "(foo*)" should be "(foo *)"
> WARNING: please, no space before tabs
>
> Cc: Christian König <christian.koenig@xxxxxxx>
> Cc: Alex Deucher <alexander.deucher@xxxxxxx>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx>

Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> ---
>  .../drm/amd/amdgpu/amdgpu_fw_attestation.c    | 38 +++++++++----------
>  1 file changed, 18 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fw_attestation.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fw_attestation.c
> index 2ca3c329de6d..2d4b67175b55 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fw_attestation.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fw_attestation.c
> @@ -32,17 +32,15 @@
>  #include "soc15_common.h"
>
>  #define FW_ATTESTATION_DB_COOKIE        0x143b6a37
> -#define FW_ATTESTATION_RECORD_VALID    1
> +#define FW_ATTESTATION_RECORD_VALID    1
>  #define FW_ATTESTATION_MAX_SIZE                4096
>
> -typedef struct FW_ATT_DB_HEADER
> -{
> +struct FW_ATT_DB_HEADER {
>         uint32_t AttDbVersion;           /* version of the fwar feature */
>         uint32_t AttDbCookie;            /* cookie as an extra check for corrupt data */
> -} FW_ATT_DB_HEADER;
> +};
>
> -typedef struct FW_ATT_RECORD
> -{
> +struct FW_ATT_RECORD {
>         uint16_t AttFwIdV1;              /* Legacy FW Type field */
>         uint16_t AttFwIdV2;              /* V2 FW ID field */
>         uint32_t AttFWVersion;           /* FW Version */
> @@ -50,7 +48,7 @@ typedef struct FW_ATT_RECORD
>         uint8_t  AttSource;              /* FW source indicator */
>         uint8_t  RecordValid;            /* Indicates whether the record is a valid entry */
>         uint32_t AttFwTaId;              /* Ta ID (only in TA Attestation Table) */
> -} FW_ATT_RECORD;
> +};
>
>  static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
>                                                   char __user *buf,
> @@ -60,15 +58,15 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
>         struct amdgpu_device *adev = (struct amdgpu_device *)file_inode(f)->i_private;
>         uint64_t records_addr = 0;
>         uint64_t vram_pos = 0;
> -       FW_ATT_DB_HEADER fw_att_hdr = {0};
> -       FW_ATT_RECORD fw_att_record = {0};
> +       struct FW_ATT_DB_HEADER fw_att_hdr = {0};
> +       struct FW_ATT_RECORD fw_att_record = {0};
>
> -       if (size < sizeof(FW_ATT_RECORD)) {
> +       if (size < sizeof(struct FW_ATT_RECORD)) {
>                 DRM_WARN("FW attestation input buffer not enough memory");
>                 return -EINVAL;
>         }
>
> -       if ((*pos + sizeof(FW_ATT_DB_HEADER)) >= FW_ATTESTATION_MAX_SIZE) {
> +       if ((*pos + sizeof(struct FW_ATT_DB_HEADER)) >= FW_ATTESTATION_MAX_SIZE) {
>                 DRM_WARN("FW attestation out of bounds");
>                 return 0;
>         }
> @@ -83,8 +81,8 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
>         if (*pos == 0) {
>                 amdgpu_device_vram_access(adev,
>                                           vram_pos,
> -                                         (uint32_t*)&fw_att_hdr,
> -                                         sizeof(FW_ATT_DB_HEADER),
> +                                         (uint32_t *)&fw_att_hdr,
> +                                         sizeof(struct FW_ATT_DB_HEADER),
>                                           false);
>
>                 if (fw_att_hdr.AttDbCookie != FW_ATTESTATION_DB_COOKIE) {
> @@ -96,20 +94,20 @@ static ssize_t amdgpu_fw_attestation_debugfs_read(struct file *f,
>         }
>
>         amdgpu_device_vram_access(adev,
> -                                 vram_pos + sizeof(FW_ATT_DB_HEADER) + *pos,
> -                                 (uint32_t*)&fw_att_record,
> -                                 sizeof(FW_ATT_RECORD),
> +                                 vram_pos + sizeof(struct FW_ATT_DB_HEADER) + *pos,
> +                                 (uint32_t *)&fw_att_record,
> +                                 sizeof(struct FW_ATT_RECORD),
>                                   false);
>
>         if (fw_att_record.RecordValid != FW_ATTESTATION_RECORD_VALID)
>                 return 0;
>
> -       if (copy_to_user(buf, (void*)&fw_att_record, sizeof(FW_ATT_RECORD)))
> +       if (copy_to_user(buf, (void *)&fw_att_record, sizeof(struct FW_ATT_RECORD)))
>                 return -EINVAL;
>
> -       *pos += sizeof(FW_ATT_RECORD);
> +       *pos += sizeof(struct FW_ATT_RECORD);
>
> -       return sizeof(FW_ATT_RECORD);
> +       return sizeof(struct FW_ATT_RECORD);
>  }
>
>  static const struct file_operations amdgpu_fw_attestation_debugfs_ops = {
> @@ -136,7 +134,7 @@ void amdgpu_fw_attestation_debugfs_init(struct amdgpu_device *adev)
>                 return;
>
>         debugfs_create_file("amdgpu_fw_attestation",
> -                           S_IRUSR,
> +                           0400,
>                             adev_to_drm(adev)->primary->debugfs_root,
>                             adev,
>                             &amdgpu_fw_attestation_debugfs_ops);
> --
> 2.25.1
>




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux