[PATCH linux-next] drm/amdgpu: use string choice helpers

Alex Deucher alexdeucher at gmail.com
Tue Oct 29 13:41:40 UTC 2024


On Sun, Oct 27, 2024 at 10:18 AM R Sundar <prosunofficial at gmail.com> wrote:
>
> Use string choice helpers for better readability.

I personally find this less readable, but if this is the preferred
method going forward, I'm fine to take the patch.

Alex

>
> Reported-by: kernel test robot <lkp at intel.com>
> Reported-by: Julia Lawall <julia.lawall at inria.fr>
> Closes: https://lore.kernel.org/r/202410161814.I6p2Nnux-lkp@intel.com/
> Signed-off-by: R Sundar <prosunofficial at gmail.com>
> ---
>
> reported in linux repository.
>
> tree:  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>
> cocci warnings: (new ones prefixed by >>)
> >> drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c:145:8-12: opportunity for str_read_write(read)
>
> vim +145 drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
>
>  drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
> index 35fee3e8cde2..8cd69836dd99 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_eeprom.c
> @@ -200,7 +200,7 @@ static int amdgpu_eeprom_xfer(struct i2c_adapter *i2c_adap, u32 eeprom_addr,
>                 dev_err_ratelimited(&i2c_adap->dev,
>                                     "maddr:0x%04X size:0x%02X:quirk max_%s_len must be > %d",
>                                     eeprom_addr, buf_size,
> -                                   read ? "read" : "write", EEPROM_OFFSET_SIZE);
> +                                   str_read_write(read), EEPROM_OFFSET_SIZE);
>                 return -EINVAL;
>         }
>
> --
> 2.34.1
>


More information about the amd-gfx mailing list