Skip to content

Commit 3f3a24a

Browse files
Luben Tuikovalexdeucher
authored andcommitted
drm/amdgpu: Don't offset by 2 in FRU EEPROM
Read buffers no longer expose the I2C address, and so we don't need to offset by two when we get the read data. Cc: Alex Deucher <Alexander.Deucher@amd.com> Cc: Kent Russell <kent.russell@amd.com> Cc: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com> Fixes: bd60716 ("drm/amdgpu: Enable reading FRU chip via I2C v3") Signed-off-by: Luben Tuikov <luben.tuikov@amd.com> Acked-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com> Reviewed-by: Kent Russell <kent.russell@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 3f1e2e9 commit 3f3a24a

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,13 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,
103103

104104
int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
105105
{
106-
unsigned char buf[AMDGPU_PRODUCT_NAME_LEN+2];
106+
unsigned char buf[AMDGPU_PRODUCT_NAME_LEN];
107107
u32 addrptr;
108108
int size, len;
109-
int offset = 2;
110109

111110
if (!is_fru_eeprom_supported(adev))
112111
return 0;
113112

114-
if (adev->asic_type == CHIP_ALDEBARAN)
115-
offset = 0;
116-
117113
/* If algo exists, it means that the i2c_adapter's initialized */
118114
if (!adev->pm.fru_eeprom_i2c_bus || !adev->pm.fru_eeprom_i2c_bus->algo) {
119115
DRM_WARN("Cannot access FRU, EEPROM accessor not initialized");
@@ -155,8 +151,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
155151
AMDGPU_PRODUCT_NAME_LEN);
156152
len = AMDGPU_PRODUCT_NAME_LEN - 1;
157153
}
158-
/* Start at 2 due to buf using fields 0 and 1 for the address */
159-
memcpy(adev->product_name, &buf[offset], len);
154+
memcpy(adev->product_name, buf, len);
160155
adev->product_name[len] = '\0';
161156

162157
addrptr += size + 1;
@@ -174,7 +169,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
174169
DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake");
175170
len = sizeof(adev->product_number) - 1;
176171
}
177-
memcpy(adev->product_number, &buf[offset], len);
172+
memcpy(adev->product_number, buf, len);
178173
adev->product_number[len] = '\0';
179174

180175
addrptr += size + 1;
@@ -201,7 +196,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
201196
DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake");
202197
len = sizeof(adev->serial) - 1;
203198
}
204-
memcpy(adev->serial, &buf[offset], len);
199+
memcpy(adev->serial, buf, len);
205200
adev->serial[len] = '\0';
206201

207202
return 0;

0 commit comments

Comments
 (0)