Skip to contentSkip to conversation

drm/amdgpu: Check if fru_addr is not NULL

PATCH New Luben Tuikov 2 participants 3 messages Dec 12, 2022

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

PATCH 1/1 drm/amdgpu: Check if fru_addr is not NULL

Always check if fru_addr is not NULL. This commit also fixes a "smatch" warning.

Cc Alex Deucher <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc kernel test robot <[email protected]>
Cc AMD Graphics <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +4 -2
index 2c38ac7bc643d5..4620c4712ce32a 100644
@@ -64,7 +64,8 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev, u32 *fru_addr)
 			    sizeof(atom_ctx->vbios_version)) ||
 		    strnstr(atom_ctx->vbios_version, "D163",
 			    sizeof(atom_ctx->vbios_version))) {
-			*fru_addr = FRU_EEPROM_MADDR_6;
+			if (fru_addr)
+				*fru_addr = FRU_EEPROM_MADDR_6;
 			return true;
 		} else {
 			return false;
@@ -83,7 +84,8 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev, u32 *fru_addr)
 				    sizeof(atom_ctx->vbios_version))) {
 				return false;
 			} else {
-				*fru_addr = FRU_EEPROM_MADDR_6;
+				if (fru_addr)
+					*fru_addr = FRU_EEPROM_MADDR_6;
 				return true;
 			}
 		} else {

base-commit: 20e03e7f6e8efd42168db6d3fe044b804e0ede8f

Signature · 1 line
2.39.0.rc2
#1 lore raw

PATCH 1/1 drm/amdgpu: Check if fru_addr is not NULL (v2)

Always check if fru_addr is not NULL. This commit also fixes a "smatch" warning.

v2: Add a Fixes tag.

Cc Alex Deucher <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc kernel test robot <[email protected]>
Cc AMD Graphics <[email protected]>
Fixes afbe5d1e4bd7c7 ("drm/amdgpu: Bug-fix: Reading I2C FRU data on newer ASICs")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +4 -2
index 2c38ac7bc643d5..4620c4712ce32a 100644
@@ -64,7 +64,8 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev, u32 *fru_addr)
 			    sizeof(atom_ctx->vbios_version)) ||
 		    strnstr(atom_ctx->vbios_version, "D163",
 			    sizeof(atom_ctx->vbios_version))) {
-			*fru_addr = FRU_EEPROM_MADDR_6;
+			if (fru_addr)
+				*fru_addr = FRU_EEPROM_MADDR_6;
 			return true;
 		} else {
 			return false;
@@ -83,7 +84,8 @@ static bool is_fru_eeprom_supported(struct amdgpu_device *adev, u32 *fru_addr)
 				    sizeof(atom_ctx->vbios_version))) {
 				return false;
 			} else {
-				*fru_addr = FRU_EEPROM_MADDR_6;
+				if (fru_addr)
+					*fru_addr = FRU_EEPROM_MADDR_6;
 				return true;
 			}
 		} else {

base-commit: 20e03e7f6e8efd42168db6d3fe044b804e0ede8f

Signature · 1 line
2.39.0.rc2
Reviewed-by on v1 1/1
#2 lore raw

RE: [PATCH] drm/amdgpu: Check if fru_addr is not NULL (v2)

[AMD Official Use Only - General]

Quoted 57 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Luben Tuikov
Sent: Monday, December 12, 2022 12:18 PM
To: AMD Graphics <[email protected]>
Cc: Deucher, Alexander <[email protected]>; Tuikov, Luben <[email protected]>; Dan Carpenter <[email protected]>; kernel test robot <[email protected]>
Subject: [PATCH] drm/amdgpu: Check if fru_addr is not NULL (v2)

Always check if fru_addr is not NULL. This commit also fixes a "smatch" warning.

v2: Add a Fixes tag.

Cc Alex Deucher <[email protected]>
Cc Dan Carpenter <[email protected]>
Cc kernel test robot <[email protected]>
Cc AMD Graphics <[email protected]>
Fixes afbe5d1e4bd7c7 ("drm/amdgpu: Bug-fix: Reading I2C FRU data on newer

ASICs")

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +2 -1
index 2c38ac7bc643d5..4620c4712ce32a 100644
@@ -64,7 +64,8 @@ static bool is_fru_eeprom_supported(struct
 amdgpu_device *adev, u32 *fru_addr)
 			    sizeof(atom_ctx->vbios_version)) ||
 		    strnstr(atom_ctx->vbios_version, "D163",
 			    sizeof(atom_ctx->vbios_version))) {
-			*fru_addr = FRU_EEPROM_MADDR_6;
+			if (fru_addr)
+				*fru_addr = FRU_EEPROM_MADDR_6;
 			return true;
 		} else {
drivers/gpu/drm/amd/amdgpu/amdgpu_fru_eeprom.c +2 -1
 			return false;
@@ -83,7 +84,8 @@ static bool is_fru_eeprom_supported(struct
 amdgpu_device *adev, u32 *fru_addr)
 				    sizeof(atom_ctx->vbios_version))) {
 				return false;
 			} else {
-				*fru_addr = FRU_EEPROM_MADDR_6;
+				if (fru_addr)
+					*fru_addr = FRU_EEPROM_MADDR_6;
 				return true;
 			}

} else {

base-commit: 20e03e7f6e8efd42168db6d3fe044b804e0ede8f --
2.39.0.rc2