Skip to content

Commit ba80900

Browse files
Kevin Wangalexdeucher
authored andcommitted
drm/amdgpu: optimize code about format string in gfx_v10_0_init_microcode()
the memset() and snprintf() is not necessary. Signed-off-by: Kevin Wang <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 2b8f731 commit ba80900

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3931,7 +3931,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
39313931
{
39323932
const char *chip_name;
39333933
char fw_name[40];
3934-
char wks[10];
3934+
char *wks = "";
39353935
int err;
39363936
struct amdgpu_firmware_info *info = NULL;
39373937
const struct common_firmware_header *header = NULL;
@@ -3944,7 +3944,6 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
39443944

39453945
DRM_DEBUG("\n");
39463946

3947-
memset(wks, 0, sizeof(wks));
39483947
switch (adev->asic_type) {
39493948
case CHIP_NAVI10:
39503949
chip_name = "navi10";
@@ -3953,7 +3952,7 @@ static int gfx_v10_0_init_microcode(struct amdgpu_device *adev)
39533952
chip_name = "navi14";
39543953
if (!(adev->pdev->device == 0x7340 &&
39553954
adev->pdev->revision != 0x00))
3956-
snprintf(wks, sizeof(wks), "_wks");
3955+
wks = "_wks";
39573956
break;
39583957
case CHIP_NAVI12:
39593958
chip_name = "navi12";

0 commit comments

Comments
 (0)