Skip to contentSkip to conversation

gpu: drm: dead code elimination

PATCH Applied Pan Zhang 2 participants 2 messages Dec 18, 2019

Subsystems (2)
lore
Share & tools
lore

Pan Zhang

author
#0 lore raw

PATCH 1/3 gpu: drm: dead code elimination

this set adds support for removal of gpu drm dead code.

patch1:
num is a data of u8 type and ATOM_MAX_HW_I2C_READ == 255,

so there is a impossible condition '(num > 255) => (0-255 > 255)'.

---
 drivers/gpu/drm/amd/amdgpu/atombios_i2c.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c +0 -5
index 980c363..b4cc7c5 100644
@@ -76,11 +76,6 @@ static int amdgpu_atombios_i2c_process_i2c_ch(struct amdgpu_i2c_chan *chan,
 		}
 		args.lpI2CDataOut = cpu_to_le16(out);
 	} else {
-		if (num > ATOM_MAX_HW_I2C_READ) {
-			DRM_ERROR("hw i2c: tried to read too many bytes (%d vs 255)\n", num);
-			r = -EINVAL;
-			goto done;
-		}
 		args.ucRegIndex = 0;
 		args.lpI2CDataOut = 0;
 	}
Signature · 1 line
2.7.4
#1 lore raw
Quoted 9 lines · Pan Zhang

this set adds support for removal of gpu drm dead code.

patch1:
num is a data of u8 type and ATOM_MAX_HW_I2C_READ == 255,

so there is a impossible condition '(num > 255) => (0-255 > 255)'.

This change was already made by someone else.

Alex

Quoted 23 lines
---
 drivers/gpu/drm/amd/amdgpu/atombios_i2c.c | 5 -----
 1 file changed, 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/atombios_i2c.c +0 -6
index 980c363..b4cc7c5 100644
@@ -76,11 +76,6 @@ static int amdgpu_atombios_i2c_process_i2c_ch(struct amdgpu_i2c_chan *chan,
                }
                args.lpI2CDataOut = cpu_to_le16(out);
        } else {
-               if (num > ATOM_MAX_HW_I2C_READ) {
-                       DRM_ERROR("hw i2c: tried to read too many bytes (%d vs 255)\n", num);
-                       r = -EINVAL;
-                       goto done;
-               }
                args.ucRegIndex = 0;
                args.lpI2CDataOut = 0;
        }
--

2.7.4

Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx