2022-01-12 08:24:37

by CGEL

[permalink] [raw]
Subject: [PATCH] drm/vmwgfx: remove redundant ret variable

From: Minghao Chi <[email protected]>

Return value from vmw_gem_object_create_with_handle() directly instead
of taking this in another redundant variable.

Reported-by: Zeal Robot <[email protected]>
Signed-off-by: Minghao Chi <[email protected]>
Signed-off-by: CGEL ZTE <[email protected]>
---
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
index 31aecc46624b..91b03f1dbbf0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_bo.c
@@ -778,18 +778,14 @@ int vmw_dumb_create(struct drm_file *file_priv,
{
struct vmw_private *dev_priv = vmw_priv(dev);
struct vmw_buffer_object *vbo;
- int ret;

args->pitch = args->width * ((args->bpp + 7) / 8);
args->size = ALIGN(args->pitch * args->height, PAGE_SIZE);

- ret = vmw_gem_object_create_with_handle(dev_priv, file_priv,
+ return vmw_gem_object_create_with_handle(dev_priv, file_priv,
args->size, &args->handle,
&vbo);

- return ret;
-}
-
/**
* vmw_bo_swap_notify - swapout notify callback.
*
--
2.25.1



2022-01-12 18:03:19

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drm/vmwgfx: remove redundant ret variable

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on drm/drm-next]
[also build test WARNING on next-20220112]
[cannot apply to v5.16]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/cgel-zte-gmail-com/drm-vmwgfx-remove-redundant-ret-variable/20220112-162527
base: git://anongit.freedesktop.org/drm/drm drm-next
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220113/[email protected]/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/3542ac844ea28aaa8528f5deb3ee52d1690f1f8a
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review cgel-zte-gmail-com/drm-vmwgfx-remove-redundant-ret-variable/20220112-162527
git checkout 3542ac844ea28aaa8528f5deb3ee52d1690f1f8a
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/gpu/drm/vmwgfx/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

drivers/gpu/drm/vmwgfx/vmwgfx_bo.c: In function 'vmw_dumb_create':
>> drivers/gpu/drm/vmwgfx/vmwgfx_bo.c:794:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
794 | void vmw_bo_swap_notify(struct ttm_buffer_object *bo)
| ^~~~
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c:860:1: error: expected declaration or statement at end of input
860 | }
| ^
At top level:
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c:853:6: warning: 'vmw_bo_is_vmw_bo' defined but not used [-Wunused-function]
853 | bool vmw_bo_is_vmw_bo(struct ttm_buffer_object *bo)
| ^~~~~~~~~~~~~~~~
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c:815:6: warning: 'vmw_bo_move_notify' defined but not used [-Wunused-function]
815 | void vmw_bo_move_notify(struct ttm_buffer_object *bo,
| ^~~~~~~~~~~~~~~~~~
drivers/gpu/drm/vmwgfx/vmwgfx_bo.c:794:6: warning: 'vmw_bo_swap_notify' defined but not used [-Wunused-function]
794 | void vmw_bo_swap_notify(struct ttm_buffer_object *bo)
| ^~~~~~~~~~~~~~~~~~


vim +794 drivers/gpu/drm/vmwgfx/vmwgfx_bo.c

e9431ea5076a91 Thomas Hellstrom 2018-06-19 761
e9431ea5076a91 Thomas Hellstrom 2018-06-19 762
e9431ea5076a91 Thomas Hellstrom 2018-06-19 763 /**
e9431ea5076a91 Thomas Hellstrom 2018-06-19 764 * vmw_dumb_create - Create a dumb kms buffer
e9431ea5076a91 Thomas Hellstrom 2018-06-19 765 *
e9431ea5076a91 Thomas Hellstrom 2018-06-19 766 * @file_priv: Pointer to a struct drm_file identifying the caller.
e9431ea5076a91 Thomas Hellstrom 2018-06-19 767 * @dev: Pointer to the drm device.
e9431ea5076a91 Thomas Hellstrom 2018-06-19 768 * @args: Pointer to a struct drm_mode_create_dumb structure
e9431ea5076a91 Thomas Hellstrom 2018-06-19 769 * Return: Zero on success, negative error code on failure.
e9431ea5076a91 Thomas Hellstrom 2018-06-19 770 *
e9431ea5076a91 Thomas Hellstrom 2018-06-19 771 * This is a driver callback for the core drm create_dumb functionality.
e9431ea5076a91 Thomas Hellstrom 2018-06-19 772 * Note that this is very similar to the vmw_bo_alloc ioctl, except
e9431ea5076a91 Thomas Hellstrom 2018-06-19 773 * that the arguments have a different format.
e9431ea5076a91 Thomas Hellstrom 2018-06-19 774 */
e9431ea5076a91 Thomas Hellstrom 2018-06-19 775 int vmw_dumb_create(struct drm_file *file_priv,
e9431ea5076a91 Thomas Hellstrom 2018-06-19 776 struct drm_device *dev,
e9431ea5076a91 Thomas Hellstrom 2018-06-19 777 struct drm_mode_create_dumb *args)
e9431ea5076a91 Thomas Hellstrom 2018-06-19 778 {
e9431ea5076a91 Thomas Hellstrom 2018-06-19 779 struct vmw_private *dev_priv = vmw_priv(dev);
e9431ea5076a91 Thomas Hellstrom 2018-06-19 780 struct vmw_buffer_object *vbo;
e9431ea5076a91 Thomas Hellstrom 2018-06-19 781
e9431ea5076a91 Thomas Hellstrom 2018-06-19 782 args->pitch = args->width * ((args->bpp + 7) / 8);
8afa13a0583f94 Zack Rusin 2021-12-06 783 args->size = ALIGN(args->pitch * args->height, PAGE_SIZE);
e9431ea5076a91 Thomas Hellstrom 2018-06-19 784
3542ac844ea28a Minghao Chi 2022-01-12 785 return vmw_gem_object_create_with_handle(dev_priv, file_priv,
8afa13a0583f94 Zack Rusin 2021-12-06 786 args->size, &args->handle,
8afa13a0583f94 Zack Rusin 2021-12-06 787 &vbo);
e9431ea5076a91 Thomas Hellstrom 2018-06-19 788
e9431ea5076a91 Thomas Hellstrom 2018-06-19 789 /**
e9431ea5076a91 Thomas Hellstrom 2018-06-19 790 * vmw_bo_swap_notify - swapout notify callback.
e9431ea5076a91 Thomas Hellstrom 2018-06-19 791 *
e9431ea5076a91 Thomas Hellstrom 2018-06-19 792 * @bo: The buffer object to be swapped out.
e9431ea5076a91 Thomas Hellstrom 2018-06-19 793 */
e9431ea5076a91 Thomas Hellstrom 2018-06-19 @794 void vmw_bo_swap_notify(struct ttm_buffer_object *bo)
e9431ea5076a91 Thomas Hellstrom 2018-06-19 795 {
e9431ea5076a91 Thomas Hellstrom 2018-06-19 796 /* Is @bo embedded in a struct vmw_buffer_object? */
8afa13a0583f94 Zack Rusin 2021-12-06 797 if (vmw_bo_is_vmw_bo(bo))
e9431ea5076a91 Thomas Hellstrom 2018-06-19 798 return;
e9431ea5076a91 Thomas Hellstrom 2018-06-19 799
e9431ea5076a91 Thomas Hellstrom 2018-06-19 800 /* Kill any cached kernel maps before swapout */
e9431ea5076a91 Thomas Hellstrom 2018-06-19 801 vmw_bo_unmap(vmw_buffer_object(bo));
e9431ea5076a91 Thomas Hellstrom 2018-06-19 802 }
e9431ea5076a91 Thomas Hellstrom 2018-06-19 803

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]