*
  * Bit 62:  Indicates a GRBM bank switch is needed
  * Bit 61:  Indicates a SRBM bank switch is needed (implies bit 62 is
- *         zero)
+ *         zero)
  * Bits 24..33: The SE or ME selector if needed
  * Bits 34..43: The SH (or SA) or PIPE selector if needed
  * Bits 44..53: The INSTANCE (or CU/WGP) or QUEUE selector if needed
  *
  * Bit 23:  Indicates that the PM power gating lock should be held
- *         This is necessary to read registers that might be
- *         unreliable during a power gating transistion.
+ *         This is necessary to read registers that might be
+ *         unreliable during a power gating transistion.
  *
  * The lower bits are the BYTE offset of the register to read.  This
  * allows reading multiple registers in a single call and having
        ssize_t result = 0;
        int r;
        bool pm_pg_lock, use_bank, use_ring;
-       unsigned instance_bank, sh_bank, se_bank, me, pipe, queue, vmid;
+       unsigned int instance_bank, sh_bank, se_bank, me, pipe, queue, vmid;
 
        pm_pg_lock = use_bank = use_ring = false;
        instance_bank = sh_bank = se_bank = me = pipe = queue = vmid = 0;
 {
        struct amdgpu_debugfs_regs2_data *rd;
 
-       rd = kzalloc(sizeof *rd, GFP_KERNEL);
+       rd = kzalloc(sizeof(*rd), GFP_KERNEL);
        if (!rd)
                return -ENOMEM;
        rd->adev = file_inode(file)->i_private;
 static int amdgpu_debugfs_regs2_release(struct inode *inode, struct file *file)
 {
        struct amdgpu_debugfs_regs2_data *rd = file->private_data;
+
        mutex_destroy(&rd->lock);
        kfree(file->private_data);
        return 0;
        switch (cmd) {
        case AMDGPU_DEBUGFS_REGS2_IOC_SET_STATE:
                mutex_lock(&rd->lock);
-               r = copy_from_user(&rd->id, (struct amdgpu_debugfs_regs2_iocdata *)data, sizeof rd->id);
+               r = copy_from_user(&rd->id, (struct amdgpu_debugfs_regs2_iocdata *)data,
+                                  sizeof(rd->id));
                mutex_unlock(&rd->lock);
                return r ? -EINVAL : 0;
        default:
  * The offset being sought changes which wave that the status data
  * will be returned for.  The bits are used as follows:
  *
- * Bits 0..6:  Byte offset into data
+ * Bits 0..6:  Byte offset into data
  * Bits 7..14: SE selector
  * Bits 15..22:        SH/SA selector
  * Bits 23..30: CU/{WGP+SIMD} selector
        &amdgpu_debugfs_gfxoff_residency_fops,
 };
 
-static const char *debugfs_regs_names[] = {
+static const char * const debugfs_regs_names[] = {
        "amdgpu_regs",
        "amdgpu_regs2",
        "amdgpu_regs_didt",
 
 /**
  * amdgpu_debugfs_regs_init -  Initialize debugfs entries that provide
- *                             register access.
+ *                             register access.
  *
  * @adev: The device to attach the debugfs entries to
  */
 
        for (i = 0; i < ARRAY_SIZE(debugfs_regs); i++) {
                ent = debugfs_create_file(debugfs_regs_names[i],
-                                         S_IFREG | S_IRUGO, root,
+                                         S_IFREG | 0444, root,
                                          adev, debugfs_regs[i]);
                if (!i && !IS_ERR_OR_NULL(ent))
                        i_size_write(ent->d_inode, adev->rmmio_size);
                kthread_park(ring->sched.thread);
        }
 
-       seq_printf(m, "run ib test:\n");
+       seq_puts(m, "run ib test:\n");
        r = amdgpu_ib_ring_tests(adev);
        if (r)
                seq_printf(m, "ib ring tests failed (%d).\n", r);
        else
-               seq_printf(m, "ib ring tests passed.\n");
+               seq_puts(m, "ib ring tests passed.\n");
 
        /* go on the scheduler */
        for (i = 0; i < AMDGPU_MAX_RINGS; i++) {
                amdgpu_debugfs_ring_init(adev, ring);
        }
 
-       for ( i = 0; i < adev->vcn.num_vcn_inst; i++) {
+       for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
                if (!amdgpu_vcnfw_log)
                        break;