Skip to contentSkip to conversation

drm/amdgpu: Increase potential product_name to 64 characters

PATCH In review Kent Russell 4 participants 9 messages Dec 17, 2021 – Dec 20, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 drm/amdgpu: Increase potential product_name to 64 characters

Having seen at least 1 42-character product_name, bump the number up to 64, and put that definition into amdgpu.h to make future adjustments simpler.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 12 +++++-------
 2 files changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -1
index e701dedce344..4e6737e4c36c 100644
@@ -813,6 +813,7 @@ struct amd_powerplay {
 
 #define AMDGPU_RESET_MAGIC_NUM 64
 #define AMDGPU_MAX_DF_PERFMONS 4
+#define PRODUCT_NAME_LEN 64
 struct amdgpu_device {
 	struct device			*dev;
 	struct pci_dev			*pdev;
@@ -1083,7 +1084,7 @@ struct amdgpu_device {
 
 	/* Chip product information */
 	char				product_number[16];
-	char				product_name[32];
+	char				product_name[PRODUCT_NAME_LEN];
 	char				serial[20];
 
 	atomic_t			throttling_logging_enabled;
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +5 -7
index 7709caeb233d..5ed24701f9cf 100644
@@ -88,7 +88,7 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,
 
 int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 {
-	unsigned char buff[34];
+	unsigned char buff[PRODUCT_NAME_LEN+2];
 	u32 addrptr;
 	int size, len;
 
@@ -131,12 +131,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 	}
 
 	len = size;
-	/* Product name should only be 32 characters. Any more,
-	 * and something could be wrong. Cap it at 32 to be safe
-	 */
-	if (len >= sizeof(adev->product_name)) {
-		DRM_WARN("FRU Product Number is larger than 32 characters. This is likely a mistake");
-		len = sizeof(adev->product_name) - 1;
+	if (len >= PRODUCT_NAME_LEN) {
+		DRM_WARN("FRU Product Name is larger than %d characters. This is likely a mistake",
+				PRODUCT_NAME_LEN);
+		len = PRODUCT_NAME_LEN - 1;
 	}
 	/* Start at 2 due to buff using fields 0 and 1 for the address */
 	memcpy(adev->product_name, &buff[2], len);
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/4 drm/amdgpu: Enable unique_id for Aldebaran

It's supported, so support the unique_id sysfs file

---
 drivers/gpu/drm/amd/pm/amdgpu_pm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2 -1
index 082539c70fd4..dfefb147ac2c 100644
@@ -2090,7 +2090,8 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_
 	} else if (DEVICE_ATTR_IS(unique_id)) {
 		if (asic_type != CHIP_VEGA10 &&
 		    asic_type != CHIP_VEGA20 &&
-		    asic_type != CHIP_ARCTURUS)
+		    asic_type != CHIP_ARCTURUS &&
+		    asic_type != CHIP_ALDEBARAN)
 			*states = ATTR_STATE_UNSUPPORTED;
 	} else if (DEVICE_ATTR_IS(pp_features)) {
 		if (adev->flags & AMD_IS_APU || asic_type < CHIP_VEGA10)
Signature · 1 line
2.25.1
#2 lore raw

PATCH 3/4 drm/amdgpu: Only overwrite serial if field is empty

In reply to Kent Russell

On Aldebaran, the serial may be obtained from the FRU. Only overwrite the serial with the unique_id if the serial is empty. This will support printing serial numbers for mGPU devices where there are 2 unique_ids for the 2 GPUs, but only one serial number for the board

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +2 -1
index 7433a051e795..5b9868011f4c 100644
@@ -1605,7 +1605,8 @@ static void aldebaran_get_unique_id(struct smu_context *smu)
 	mutex_unlock(&smu->metrics_lock);
 
 	adev->unique_id = ((uint64_t)upper32 << 32) | lower32;
-	sprintf(adev->serial, "%016llx", adev->unique_id);
+	if (adev->serial[0] == '\0')
+		sprintf(adev->serial, "%016llx", adev->unique_id);
 }
 
 static bool aldebaran_is_baco_supported(struct smu_context *smu)
Signature · 1 line
2.25.1
#3 lore raw

PATCH 4/4 drm/amdgpu: Access the FRU on Aldebaran

In reply to Kent Russell

This is supported, although the offset is different from VG20, so fix that with a variable and enable getting the product name and serial number from the FRU. Do this for all SKUs since all SKUs have the FRU

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +10 -3
index 5ed24701f9cf..80f43e69e659 100644
@@ -56,6 +56,9 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev)
 			return true;
 		else
 			return false;
+	case CHIP_ALDEBARAN:
+		/* All Aldebaran SKUs have the FRU */
+		return true;
 	default:
 		return false;
 	}
@@ -91,6 +94,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 	unsigned char buff[PRODUCT_NAME_LEN+2];
 	u32 addrptr;
 	int size, len;
+	int offset = 2;
+
+	if (adev->asic_type == CHIP_ALDEBARAN)
+		offset = 0;
 
 	if (!is_fru_eeprom_supported(adev))
 		return 0;
@@ -137,7 +144,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		len = PRODUCT_NAME_LEN - 1;
 	}
 	/* Start at 2 due to buff using fields 0 and 1 for the address */
-	memcpy(adev->product_name, &buff[2], len);
+	memcpy(adev->product_name, &buff[offset], len);
 	adev->product_name[len] = '\0';
 
 	addrptr += size + 1;
@@ -155,7 +162,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake");
 		len = sizeof(adev->product_number) - 1;
 	}
-	memcpy(adev->product_number, &buff[2], len);
+	memcpy(adev->product_number, &buff[offset], len);
 	adev->product_number[len] = '\0';
 
 	addrptr += size + 1;
@@ -182,7 +189,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake");
 		len = sizeof(adev->serial) - 1;
 	}
-	memcpy(adev->serial, &buff[2], len);
+	memcpy(adev->serial, &buff[offset], len);
 	adev->serial[len] = '\0';
 
 	return 0;
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 4/4
#4 lore raw

Re: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

[AMD Official Use Only]

Series is:

________________________________
From: amd-gfx <[email protected]> on behalf of Kent Russell <[email protected]>
Sent: Friday, December 17, 2021 10:31 AM
To: [email protected] <[email protected]>
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

This is supported, although the offset is different from VG20, so fix that with a variable and enable getting the product name and serial number from the FRU. Do this for all SKUs since all SKUs have the FRU

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +10 -3
index 5ed24701f9cf..80f43e69e659 100644
@@ -56,6 +56,9 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev)
                         return true;
                 else
                         return false;
+       case CHIP_ALDEBARAN:
+               /* All Aldebaran SKUs have the FRU */
+               return true;
         default:
                 return false;
         }
@@ -91,6 +94,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
         unsigned char buff[PRODUCT_NAME_LEN+2];
         u32 addrptr;
         int size, len;
+       int offset = 2;
+
+       if (adev->asic_type == CHIP_ALDEBARAN)
+               offset = 0;
 
         if (!is_fru_eeprom_supported(adev))
                 return 0;
@@ -137,7 +144,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
                 len = PRODUCT_NAME_LEN - 1;
         }
         /* Start at 2 due to buff using fields 0 and 1 for the address */
-       memcpy(adev->product_name, &buff[2], len);
+       memcpy(adev->product_name, &buff[offset], len);
         adev->product_name[len] = '\0';
 
         addrptr += size + 1;
@@ -155,7 +162,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
                 DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake");
                 len = sizeof(adev->product_number) - 1;
         }
-       memcpy(adev->product_number, &buff[2], len);
+       memcpy(adev->product_number, &buff[offset], len);
         adev->product_number[len] = '\0';
 
         addrptr += size + 1;
@@ -182,7 +189,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
                 DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake");
                 len = sizeof(adev->serial) - 1;
         }
-       memcpy(adev->serial, &buff[2], len);
+       memcpy(adev->serial, &buff[offset], len);
         adev->serial[len] = '\0';
 
         return 0;

--
2.25.1

#5 lore raw

RE: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

In reply to Kent Russell

[Public]

Hi Kent,

+
+ if (adev->asic_type == CHIP_ALDEBARAN)
+ offset = 0;

if (!is_fru_eeprom_supported(adev))

I prefer to put 'adev->asic_type == CHIP_ALDEBARAN' after calling is_fru_eeprom_supported to make code logic cleaner. Without FRU support, we should do nothing.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Kent Russell
Sent: Friday, December 17, 2021 11:32 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

This is supported, although the offset is different from VG20, so fix that with a variable and enable getting the product name and serial number from the FRU. Do this for all SKUs since all SKUs have the FRU

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +10 -3
index 5ed24701f9cf..80f43e69e659 100644
@@ -56,6 +56,9 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev)
 			return true;
 		else
 			return false;
+	case CHIP_ALDEBARAN:
+		/* All Aldebaran SKUs have the FRU */
+		return true;
 	default:
 		return false;
 	}
@@ -91,6 +94,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 	unsigned char buff[PRODUCT_NAME_LEN+2];
 	u32 addrptr;
 	int size, len;
+	int offset = 2;
+
+	if (adev->asic_type == CHIP_ALDEBARAN)
+		offset = 0;
 
 	if (!is_fru_eeprom_supported(adev))
 		return 0;
@@ -137,7 +144,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		len = PRODUCT_NAME_LEN - 1;
 	}
 	/* Start at 2 due to buff using fields 0 and 1 for the address */
-	memcpy(adev->product_name, &buff[2], len);
+	memcpy(adev->product_name, &buff[offset], len);
 	adev->product_name[len] = '\0';
 
 	addrptr += size + 1;
@@ -155,7 +162,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		DRM_WARN("FRU Product Number is larger than 16 characters. This is likely a mistake");
 		len = sizeof(adev->product_number) - 1;
 	}
-	memcpy(adev->product_number, &buff[2], len);
+	memcpy(adev->product_number, &buff[offset], len);
 	adev->product_number[len] = '\0';
 
 	addrptr += size + 1;
@@ -182,7 +189,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a mistake");
 		len = sizeof(adev->serial) - 1;
 	}
-	memcpy(adev->serial, &buff[2], len);
+	memcpy(adev->serial, &buff[offset], len);
 	adev->serial[len] = '\0';
 
 	return 0;

--
2.25.1

#6 lore raw

RE: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

That's fine, I can do that change and submit the series per Alex's RB.

Kent

Quoted 97 lines

-----Original Message-----
From: Chen, Guchun <[email protected]>
Sent: Friday, December 17, 2021 9:49 PM
To: Russell, Kent <[email protected]>; [email protected]
Cc: Russell, Kent <[email protected]>
Subject: RE: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

[Public]

Hi Kent,

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +3 -0
+
+	if (adev->asic_type == CHIP_ALDEBARAN)
+		offset = 0;
 
 	if (!is_fru_eeprom_supported(adev))

I prefer to put 'adev->asic_type == CHIP_ALDEBARAN' after calling is_fru_eeprom_supported to make code logic cleaner. Without FRU support, we should do nothing.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Kent Russell
Sent: Friday, December 17, 2021 11:32 PM
To: [email protected]
Cc: Russell, Kent <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: Access the FRU on Aldebaran

This is supported, although the offset is different from VG20, so fix that with a variable and enable getting the product name and serial number from the FRU. Do this for all SKUs since all SKUs have the FRU

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +9 -2
index 5ed24701f9cf..80f43e69e659 100644
@@ -56,6 +56,9 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev)
 			return true;
 		else
 			return false;
+	case CHIP_ALDEBARAN:
+		/* All Aldebaran SKUs have the FRU */
+		return true;
 	default:
 		return false;
 	}
@@ -91,6 +94,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 	unsigned char buff[PRODUCT_NAME_LEN+2];
 	u32 addrptr;
 	int size, len;
+	int offset = 2;
+
+	if (adev->asic_type == CHIP_ALDEBARAN)
+		offset = 0;
 
 	if (!is_fru_eeprom_supported(adev))
 		return 0;
@@ -137,7 +144,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		len = PRODUCT_NAME_LEN - 1;
 	}
 	/* Start at 2 due to buff using fields 0 and 1 for the address */
-	memcpy(adev->product_name, &buff[2], len);
+	memcpy(adev->product_name, &buff[offset], len);
 	adev->product_name[len] = '\0';
 
 	addrptr += size + 1;
@@ -155,7 +162,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		DRM_WARN("FRU Product Number is larger than 16 characters. This is likely
 a mistake");
 		len = sizeof(adev->product_number) - 1;
 	}
-	memcpy(adev->product_number, &buff[2], len);
+	memcpy(adev->product_number, &buff[offset], len);
 	adev->product_number[len] = '\0';
 
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +1 -1
 	addrptr += size + 1;
@@ -182,7 +189,7 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
 		DRM_WARN("FRU Serial Number is larger than 16 characters. This is likely a
 mistake");
 		len = sizeof(adev->serial) - 1;
 	}
-	memcpy(adev->serial, &buff[2], len);
+	memcpy(adev->serial, &buff[offset], len);
 	adev->serial[len] = '\0';
 

return 0;
--
2.25.1

#7 lore raw
In reply to Kent Russell

Am 17.12.21 um 16:31 schrieb Kent Russell:

Quoted 15 lines

Having seen at least 1 42-character product_name, bump the number up to 64, and put that definition into amdgpu.h to make future adjustments simpler.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 12 +++++-------
  2 files changed, 7 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -0
index e701dedce344..4e6737e4c36c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amd_powerplay { · line 816

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -813,6 +813,7 @@ struct amd_powerplay {
 
  #define AMDGPU_RESET_MAGIC_NUM 64
  #define AMDGPU_MAX_DF_PERFMONS 4
+#define PRODUCT_NAME_LEN 64

Please prefix all defines with AMDGPU_, apart from that looks good to me.

Regards,
Christian.

Quoted 42 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
  struct amdgpu_device {
  	struct device			*dev;
  	struct pci_dev			*pdev;
@@ -1083,7 +1084,7 @@ struct amdgpu_device {
 
  	/* Chip product information */
  	char				product_number[16];
-	char				product_name[32];
+	char				product_name[PRODUCT_NAME_LEN];
  	char				serial[20];
 
  	atomic_t			throttling_logging_enabled;
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +5 -7
index 7709caeb233d..5ed24701f9cf 100644
@@ -88,7 +88,7 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev, uint32_t addrptr,
 
  int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
  {
-	unsigned char buff[34];
+	unsigned char buff[PRODUCT_NAME_LEN+2];
  	u32 addrptr;
  	int size, len;
 
@@ -131,12 +131,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
  	}
 
  	len = size;
-	/* Product name should only be 32 characters. Any more,
-	 * and something could be wrong. Cap it at 32 to be safe
-	 */
-	if (len >= sizeof(adev->product_name)) {
-		DRM_WARN("FRU Product Number is larger than 32 characters. This is likely a mistake");
-		len = sizeof(adev->product_name) - 1;
+	if (len >= PRODUCT_NAME_LEN) {
+		DRM_WARN("FRU Product Name is larger than %d characters. This is likely a mistake",
+				PRODUCT_NAME_LEN);
+		len = PRODUCT_NAME_LEN - 1;
  	}
  	/* Start at 2 due to buff using fields 0 and 1 for the address */
  	memcpy(adev->product_name, &buff[2], len);
#8 lore raw

[AMD Official Use Only]

Will do. Thanks!

Kent

Quoted 82 lines

-----Original Message-----
From: Christian König <[email protected]>
Sent: Saturday, December 18, 2021 9:36 AM
To: Russell, Kent <[email protected]>; [email protected]
Subject: Re: [PATCH 1/4] drm/amdgpu: Increase potential product_name to 64 characters

Am 17.12.21 um 16:31 schrieb Kent Russell:

Review

Quoted 11 lines

Having seen at least 1 42-character product_name, bump the number up to 64, and put that definition into amdgpu.h to make future adjustments simpler.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h            |  3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 12 +++++-------
  2 files changed, 7 insertions(+), 8 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu.h

drivers/gpu/drm/amd/amdgpu/amdgpu.h struct amd_powerplay { · line 816

Quoted 8 lines

index e701dedce344..4e6737e4c36c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
@@ -813,6 +813,7 @@ struct amd_powerplay {
 
  #define AMDGPU_RESET_MAGIC_NUM 64
  #define AMDGPU_MAX_DF_PERFMONS 4
+#define PRODUCT_NAME_LEN 64

Please prefix all defines with AMDGPU_, apart from that looks good to me.

Regards,
Christian.

Review

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -1
  struct amdgpu_device {
    struct device                   *dev;
    struct pci_dev                  *pdev;
@@ -1083,7 +1084,7 @@ struct amdgpu_device {
 
    /* Chip product information */
    char                            product_number[16];
-   char                            product_name[32];
+   char                            product_name[PRODUCT_NAME_LEN];
    char                            serial[20];
 
    atomic_t                        throttling_logging_enabled;
(quoted diff) +0 -0

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

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev,

Quoted 4 lines

index 7709caeb233d..5ed24701f9cf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +0 -0
@@ -88,7 +88,7 @@ static int amdgpu_fru_read_eeprom(struct amdgpu_device *adev,

uint32_t addrptr,

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c int amdgpu_fru_get_product_info(struct amdgpu_device

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +1 -1
  int amdgpu_fru_get_product_info(struct amdgpu_device *adev)
  {
-   unsigned char buff[34];
+   unsigned char buff[PRODUCT_NAME_LEN+2];
    u32 addrptr;
    int size, len;
 
@@ -131,12 +131,10 @@ int amdgpu_fru_get_product_info(struct amdgpu_device

*adev)

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c int amdgpu_fru_get_product_info(struct amdgpu_device *adev)

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +0 -5
    }
 
    len = size;
-   /* Product name should only be 32 characters. Any more,
-    * and something could be wrong. Cap it at 32 to be safe
-    */
-   if (len >= sizeof(adev->product_name)) {
-           DRM_WARN("FRU Product Number is larger than 32 characters. This is likely

a mistake");

drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c int amdgpu_fru_get_product_info(struct amdgpu_device *adev)

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +2 -1
-           len = sizeof(adev->product_name) - 1;
+   if (len >= PRODUCT_NAME_LEN) {
+           DRM_WARN("FRU Product Name is larger than %d characters. This is likely a

mistake",

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +2 -0
+                           PRODUCT_NAME_LEN);
+           len = PRODUCT_NAME_LEN - 1;
    }
    /* Start at 2 due to buff using fields 0 and 1 for the address */
    memcpy(adev->product_name, &buff[2], len);