drivers/gpu/drm/v3d/v3d_gem.c:778:53: sparse: sparse: Using plain integer as NULL pointer

From: kernel test robot
Date: Wed Nov 10 2021 - 00:05:48 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: cb690f5238d71f543f4ce874aa59237cf53a877c
commit: e4165ae8304e5ea822fbe5909dd3be5445c058b7 drm/v3d: add multiple syncobjs support
date: 5 weeks ago
config: riscv-allyesconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e4165ae8304e5ea822fbe5909dd3be5445c058b7
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout e4165ae8304e5ea822fbe5909dd3be5445c058b7
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=riscv SHELL=/bin/bash drivers/gpu/drm/v3d/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> drivers/gpu/drm/v3d/v3d_gem.c:778:53: sparse: sparse: Using plain integer as NULL pointer
drivers/gpu/drm/v3d/v3d_gem.c:1011:45: sparse: sparse: Using plain integer as NULL pointer

vim +778 drivers/gpu/drm/v3d/v3d_gem.c

705
706 /**
707 * v3d_submit_cl_ioctl() - Submits a job (frame) to the V3D.
708 * @dev: DRM device
709 * @data: ioctl argument
710 * @file_priv: DRM file for this fd
711 *
712 * This is the main entrypoint for userspace to submit a 3D frame to
713 * the GPU. Userspace provides the binner command list (if
714 * applicable), and the kernel sets up the render command list to draw
715 * to the framebuffer described in the ioctl, using the command lists
716 * that the 3D engine's binner will produce.
717 */
718 int
719 v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
720 struct drm_file *file_priv)
721 {
722 struct v3d_dev *v3d = to_v3d_dev(dev);
723 struct v3d_file_priv *v3d_priv = file_priv->driver_priv;
724 struct drm_v3d_submit_cl *args = data;
725 struct v3d_submit_ext se = {0};
726 struct v3d_bin_job *bin = NULL;
727 struct v3d_render_job *render = NULL;
728 struct v3d_job *clean_job = NULL;
729 struct v3d_job *last_job;
730 struct ww_acquire_ctx acquire_ctx;
731 int ret = 0;
732
733 trace_v3d_submit_cl_ioctl(&v3d->drm, args->rcl_start, args->rcl_end);
734
735 if (args->pad)
736 return -EINVAL;
737
738 if (args->flags &&
739 args->flags & ~(DRM_V3D_SUBMIT_CL_FLUSH_CACHE |
740 DRM_V3D_SUBMIT_EXTENSION)) {
741 DRM_INFO("invalid flags: %d\n", args->flags);
742 return -EINVAL;
743 }
744
745 if (args->flags & DRM_V3D_SUBMIT_EXTENSION) {
746 ret = v3d_get_extensions(file_priv, args->extensions, &se);
747 if (ret) {
748 DRM_DEBUG("Failed to get extensions.\n");
749 return ret;
750 }
751 }
752
753 ret = v3d_job_init(v3d, file_priv, (void *)&render, sizeof(*render),
754 v3d_render_job_free, args->in_sync_rcl, &se, V3D_RENDER);
755 if (ret)
756 goto fail;
757
758 render->start = args->rcl_start;
759 render->end = args->rcl_end;
760 INIT_LIST_HEAD(&render->unref_list);
761
762 if (args->bcl_start != args->bcl_end) {
763 ret = v3d_job_init(v3d, file_priv, (void *)&bin, sizeof(*bin),
764 v3d_job_free, args->in_sync_bcl, &se, V3D_BIN);
765 if (ret)
766 goto fail;
767
768 bin->start = args->bcl_start;
769 bin->end = args->bcl_end;
770 bin->qma = args->qma;
771 bin->qms = args->qms;
772 bin->qts = args->qts;
773 bin->render = render;
774 }
775
776 if (args->flags & DRM_V3D_SUBMIT_CL_FLUSH_CACHE) {
777 ret = v3d_job_init(v3d, file_priv, (void *)&clean_job, sizeof(*clean_job),
> 778 v3d_job_free, 0, 0, V3D_CACHE_CLEAN);
779 if (ret)
780 goto fail;
781
782 last_job = clean_job;
783 } else {
784 last_job = &render->base;
785 }
786
787 ret = v3d_lookup_bos(dev, file_priv, last_job,
788 args->bo_handles, args->bo_handle_count);
789 if (ret)
790 goto fail;
791
792 ret = v3d_lock_bo_reservations(last_job, &acquire_ctx);
793 if (ret)
794 goto fail;
795
796 if (args->perfmon_id) {
797 render->base.perfmon = v3d_perfmon_find(v3d_priv,
798 args->perfmon_id);
799
800 if (!render->base.perfmon) {
801 ret = -ENOENT;
802 goto fail;
803 }
804 }
805
806 mutex_lock(&v3d->sched_lock);
807 if (bin) {
808 bin->base.perfmon = render->base.perfmon;
809 v3d_perfmon_get(bin->base.perfmon);
810 v3d_push_job(&bin->base);
811
812 ret = drm_sched_job_add_dependency(&render->base.base,
813 dma_fence_get(bin->base.done_fence));
814 if (ret)
815 goto fail_unreserve;
816 }
817
818 v3d_push_job(&render->base);
819
820 if (clean_job) {
821 struct dma_fence *render_fence =
822 dma_fence_get(render->base.done_fence);
823 ret = drm_sched_job_add_dependency(&clean_job->base,
824 render_fence);
825 if (ret)
826 goto fail_unreserve;
827 clean_job->perfmon = render->base.perfmon;
828 v3d_perfmon_get(clean_job->perfmon);
829 v3d_push_job(clean_job);
830 }
831
832 mutex_unlock(&v3d->sched_lock);
833
834 v3d_attach_fences_and_unlock_reservation(file_priv,
835 last_job,
836 &acquire_ctx,
837 args->out_sync,
838 &se,
839 last_job->done_fence);
840
841 if (bin)
842 v3d_job_put(&bin->base);
843 v3d_job_put(&render->base);
844 if (clean_job)
845 v3d_job_put(clean_job);
846
847 return 0;
848
849 fail_unreserve:
850 mutex_unlock(&v3d->sched_lock);
851 drm_gem_unlock_reservations(last_job->bo,
852 last_job->bo_count, &acquire_ctx);
853 fail:
854 v3d_job_cleanup((void *)bin);
855 v3d_job_cleanup((void *)render);
856 v3d_job_cleanup(clean_job);
857 v3d_put_multisync_post_deps(&se);
858
859 return ret;
860 }
861

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip