Skip to contentSkip to conversation

drivers/gpu/drm/ttm/tests/ttm_pool_test.c:231:37: warning: cast to pointer from integer of different size

PATCH kernel test robot 1 participant 1 message Aug 14, 2023

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   git://anongit.freedesktop.org/drm/drm-misc for-linux-next
head:   f5d8f9c0d8b4bc8ad7e7b23a9f4d116e99202dd3
commit: 204042049a941d2a9a7d49bdcda768578b5f88ec [3/3] drm/ttm/tests: Add tests for ttm_pool
config: arm-randconfig-m041-20230815 (https://download.01.org/0day-ci/archive/20230815/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230815/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/drm/drm_kunit_helpers.h:6,
from drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.h:12, from drivers/gpu/drm/ttm/tests/ttm_pool_test.c:10:
drivers/gpu/drm/ttm/tests/ttm_pool_test.c: In function 'ttm_pool_alloc_basic_dma_addr':

>> drivers/gpu/drm/ttm/tests/ttm_pool_test.c:231:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     231 |         KUNIT_ASSERT_NOT_NULL(test, (void *)dma1);
         |                                     ^
   include/kunit/test.h:598:22: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
     598 |         const typeof(left) __left = (left);                                    \
         |                      ^~~~
   include/kunit/test.h:1384:9: note: in expansion of macro 'KUNIT_BINARY_PTR_ASSERTION'
    1384 |         KUNIT_BINARY_PTR_ASSERTION(test,                                       \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1379:9: note: in expansion of macro 'KUNIT_ASSERT_NOT_NULL_MSG'
    1379 |         KUNIT_ASSERT_NOT_NULL_MSG(test,                                        \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/ttm/tests/ttm_pool_test.c:231:9: note: in expansion of macro 'KUNIT_ASSERT_NOT_NULL'
     231 |         KUNIT_ASSERT_NOT_NULL(test, (void *)dma1);
         |         ^~~~~~~~~~~~~~~~~~~~~
>> drivers/gpu/drm/ttm/tests/ttm_pool_test.c:231:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     231 |         KUNIT_ASSERT_NOT_NULL(test, (void *)dma1);
         |                                     ^
   include/kunit/test.h:598:38: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
     598 |         const typeof(left) __left = (left);                                    \
         |                                      ^~~~
   include/kunit/test.h:1384:9: note: in expansion of macro 'KUNIT_BINARY_PTR_ASSERTION'
    1384 |         KUNIT_BINARY_PTR_ASSERTION(test,                                       \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1379:9: note: in expansion of macro 'KUNIT_ASSERT_NOT_NULL_MSG'
    1379 |         KUNIT_ASSERT_NOT_NULL_MSG(test,                                        \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/ttm/tests/ttm_pool_test.c:231:9: note: in expansion of macro 'KUNIT_ASSERT_NOT_NULL'
     231 |         KUNIT_ASSERT_NOT_NULL(test, (void *)dma1);
         |         ^~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/ttm/tests/ttm_pool_test.c:232:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     232 |         KUNIT_ASSERT_NOT_NULL(test, (void *)dma2);
         |                                     ^
   include/kunit/test.h:598:22: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
     598 |         const typeof(left) __left = (left);                                    \
         |                      ^~~~
   include/kunit/test.h:1384:9: note: in expansion of macro 'KUNIT_BINARY_PTR_ASSERTION'
    1384 |         KUNIT_BINARY_PTR_ASSERTION(test,                                       \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1379:9: note: in expansion of macro 'KUNIT_ASSERT_NOT_NULL_MSG'
    1379 |         KUNIT_ASSERT_NOT_NULL_MSG(test,                                        \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/ttm/tests/ttm_pool_test.c:232:9: note: in expansion of macro 'KUNIT_ASSERT_NOT_NULL'
     232 |         KUNIT_ASSERT_NOT_NULL(test, (void *)dma2);
         |         ^~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/ttm/tests/ttm_pool_test.c:232:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     232 |         KUNIT_ASSERT_NOT_NULL(test, (void *)dma2);
         |                                     ^
   include/kunit/test.h:598:38: note: in definition of macro 'KUNIT_BASE_BINARY_ASSERTION'
     598 |         const typeof(left) __left = (left);                                    \
         |                                      ^~~~
   include/kunit/test.h:1384:9: note: in expansion of macro 'KUNIT_BINARY_PTR_ASSERTION'
    1384 |         KUNIT_BINARY_PTR_ASSERTION(test,                                       \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/kunit/test.h:1379:9: note: in expansion of macro 'KUNIT_ASSERT_NOT_NULL_MSG'
    1379 |         KUNIT_ASSERT_NOT_NULL_MSG(test,                                        \
         |         ^~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/ttm/tests/ttm_pool_test.c:232:9: note: in expansion of macro 'KUNIT_ASSERT_NOT_NULL'
     232 |         KUNIT_ASSERT_NOT_NULL(test, (void *)dma2);
         |         ^~~~~~~~~~~~~~~~~~~~~

vim +231 drivers/gpu/drm/ttm/tests/ttm_pool_test.c

195
196 static void ttm_pool_alloc_basic_dma_addr(struct kunit *test)
197 {
198 struct ttm_pool_test_priv *priv = test->priv;
199 struct ttm_test_devices *devs = priv->devs;
200 const struct ttm_pool_test_case *params = test->param_value;
201 struct ttm_tt *tt;
202 struct ttm_pool *pool;
203 struct ttm_buffer_object *bo;
204 dma_addr_t dma1, dma2;
205 enum ttm_caching caching = ttm_uncached;
206 unsigned int expected_num_pages = 1 << params->order;
207 size_t size = expected_num_pages * PAGE_SIZE;
208 int err;
209
210 tt = kunit_kzalloc(test, sizeof(*tt), GFP_KERNEL);
211 KUNIT_ASSERT_NOT_NULL(test, tt);
212
213 bo = ttm_bo_kunit_init(test, devs, size);
214 KUNIT_ASSERT_NOT_NULL(test, bo);
215
216 err = ttm_sg_tt_init(tt, bo, 0, caching);
217 KUNIT_ASSERT_EQ(test, err, 0);
218
219 pool = kunit_kzalloc(test, sizeof(*pool), GFP_KERNEL);
220 KUNIT_ASSERT_NOT_NULL(test, pool);
221
222 ttm_pool_init(pool, devs->dev, NUMA_NO_NODE, true, false);
223
224 err = ttm_pool_alloc(pool, tt, &simple_ctx);
225 KUNIT_ASSERT_EQ(test, err, 0);
226 KUNIT_ASSERT_EQ(test, tt->num_pages, expected_num_pages);
227
228 dma1 = tt->dma_address[0];
229 dma2 = tt->dma_address[tt->num_pages - 1];
230

 > 231		KUNIT_ASSERT_NOT_NULL(test, (void *)dma1);

232 KUNIT_ASSERT_NOT_NULL(test, (void *)dma2);
233
234 ttm_pool_free(pool, tt);
235 ttm_tt_fini(tt);
236 ttm_pool_fini(pool);
237 }
238

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki