On Thu, Apr 13, 2023 at 08:06:08AM +0300, Dan Carpenter wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 7d8214bba44c1aa6a75921a09a691945d26a8d43 > commit: f75d19827b731c6f24930ef77e5a46cf2242bc68 [8309/10976] drm/tegra: Allow compile test on !ARM v2 > config: xtensa-randconfig-m041-20230411 (https://download.01.org/0day-ci/archive/20230413/202304131214.MOOEMszN-lkp@xxxxxxxxx/config) > compiler: xtensa-linux-gcc (GCC) 12.1.0 > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot <lkp@xxxxxxxxx> > | Reported-by: Dan Carpenter <error27@xxxxxxxxx> > | Link: https://lore.kernel.org/r/202304131214.MOOEMszN-lkp@xxxxxxxxx/ > > smatch warnings: > drivers/gpu/host1x/context.c:82 host1x_memory_context_list_init() warn: missing error code 'err' > > vim +/err +82 drivers/gpu/host1x/context.c > > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 21 int host1x_memory_context_list_init(struct host1x *host1x) > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 22 { > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 23 struct host1x_memory_context_list *cdl = &host1x->context_list; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 24 struct device_node *node = host1x->dev->of_node; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 25 struct host1x_memory_context *ctx; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 26 unsigned int i; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 27 int err; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 28 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 29 cdl->devs = NULL; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 30 cdl->len = 0; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 31 mutex_init(&cdl->lock); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 32 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 33 err = of_property_count_u32_elems(node, "iommu-map"); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 34 if (err < 0) > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 35 return 0; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 36 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 37 cdl->devs = kcalloc(err, sizeof(*cdl->devs), GFP_KERNEL); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 38 if (!cdl->devs) > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 39 return -ENOMEM; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 40 cdl->len = err / 4; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 41 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 42 for (i = 0; i < cdl->len; i++) { > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 43 ctx = &cdl->devs[i]; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 44 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 45 ctx->host = host1x; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 46 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 47 device_initialize(&ctx->dev); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 48 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 49 /* > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 50 * Due to an issue with T194 NVENC, only 38 bits can be used. > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 51 * Anyway, 256GiB of IOVA ought to be enough for anyone. > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 52 */ > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 53 ctx->dma_mask = DMA_BIT_MASK(38); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 54 ctx->dev.dma_mask = &ctx->dma_mask; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 55 ctx->dev.coherent_dma_mask = ctx->dma_mask; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 56 dev_set_name(&ctx->dev, "host1x-ctx.%d", i); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 57 ctx->dev.bus = &host1x_context_device_bus_type; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 58 ctx->dev.parent = host1x->dev; > 55879dad0f3ae8 Yang Yingliang 2022-11-26 59 ctx->dev.release = host1x_memory_context_release; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 60 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 61 dma_set_max_seg_size(&ctx->dev, UINT_MAX); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 62 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 63 err = device_add(&ctx->dev); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 64 if (err) { > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 65 dev_err(host1x->dev, "could not add context device %d: %d\n", i, err); > 55879dad0f3ae8 Yang Yingliang 2022-11-26 66 put_device(&ctx->dev); > 55879dad0f3ae8 Yang Yingliang 2022-11-26 67 goto unreg_devices; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 68 } > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 69 > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 70 err = of_dma_configure_id(&ctx->dev, node, true, &i); > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 71 if (err) { > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 72 dev_err(host1x->dev, "IOMMU configuration failed for context device %d: %d\n", > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 73 i, err); > 55879dad0f3ae8 Yang Yingliang 2022-11-26 74 device_unregister(&ctx->dev); > 55879dad0f3ae8 Yang Yingliang 2022-11-26 75 goto unreg_devices; > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 76 } > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 77 > 9026ba722360ce Thierry Reding 2022-11-17 78 if (!tegra_dev_iommu_get_stream_id(&ctx->dev, &ctx->stream_id) || > 9026ba722360ce Thierry Reding 2022-11-17 79 !device_iommu_mapped(&ctx->dev)) { > 8aa5bcb6161206 Mikko Perttunen 2022-06-27 80 dev_err(host1x->dev, "Context device %d has no IOMMU!\n", i); > 55879dad0f3ae8 Yang Yingliang 2022-11-26 81 device_unregister(&ctx->dev); > 55879dad0f3ae8 Yang Yingliang 2022-11-26 @82 goto unreg_devices; > > error code? We don't actually want this to be a fatal failure, so err = 0 is what we want here. Should we set err = 0 explicitly here to appease smatch? Thierry
Attachment:
signature.asc
Description: PGP signature