[kbuild] drivers/gpu/drm/exynos/exynos_drm_g2d.c:907 g2d_runqueue_worker() warn: inconsistent returns '&g2d->runqueue_mutex'.

From: Dan Carpenter
Date: Tue Aug 24 2021 - 07:22:40 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d5ae8d7f85b7f6f6e60f1af8ff4be52b0926fde1
commit: 445d3bed75de4082c7c7794030ac9a5b8bfde886 drm/exynos: use pm_runtime_resume_and_get()
config: openrisc-randconfig-m031-20210824 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.0

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

New smatch warnings:
drivers/gpu/drm/exynos/exynos_drm_g2d.c:907 g2d_runqueue_worker() warn: inconsistent returns '&g2d->runqueue_mutex'.

Old smatch warnings:
drivers/gpu/drm/exynos/exynos_drm_g2d.c:1237 exynos_g2d_set_cmdlist_ioctl() error: copy_from_user() 'cmdlist->data[cmdlist->last]' too small (2040 vs 4080)
(Presumably this warning is generated from a 32 bit config. The
cmdlist->data[] is a unsigned long, but the code in
exynos_g2d_set_cmdlist_ioctl() assumes it's 64 bit. )

vim +907 drivers/gpu/drm/exynos/exynos_drm_g2d.c

d7f1642c90ab5eb Joonyoung Shim 2012-05-17 864 static void g2d_runqueue_worker(struct work_struct *work)
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 865 {
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 866 struct g2d_data *g2d = container_of(work, struct g2d_data,
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 867 runqueue_work);
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 868 struct g2d_runqueue_node *runqueue_node;
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 869
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 870 /*
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 871 * The engine is busy and the completion of the current node is going
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 872 * to poke the runqueue worker, so nothing to do here.
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 873 */
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 874 if (test_bit(G2D_BIT_ENGINE_BUSY, &g2d->flags))
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 875 return;
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 876
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 877 mutex_lock(&g2d->runqueue_mutex);
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 878
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 879 runqueue_node = g2d->runqueue_node;
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 880 g2d->runqueue_node = NULL;
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 881
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 882 if (runqueue_node) {
7c3fc2b5ccd6694 Tobias Jakobi 2016-09-27 883 pm_runtime_mark_last_busy(g2d->dev);
7c3fc2b5ccd6694 Tobias Jakobi 2016-09-27 884 pm_runtime_put_autosuspend(g2d->dev);
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 885
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 886 complete(&runqueue_node->complete);
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 887 if (runqueue_node->async)
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 888 g2d_free_runqueue_node(g2d, runqueue_node);
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 889 }
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 890
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 891 if (!test_bit(G2D_BIT_SUSPEND_RUNQUEUE, &g2d->flags)) {
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 892 g2d->runqueue_node = g2d_get_runqueue_node(g2d);
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 893
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 894 if (g2d->runqueue_node) {
445d3bed75de408 Inki Dae 2021-05-25 895 int ret;
445d3bed75de408 Inki Dae 2021-05-25 896
445d3bed75de408 Inki Dae 2021-05-25 897 ret = pm_runtime_resume_and_get(g2d->dev);
445d3bed75de408 Inki Dae 2021-05-25 898 if (ret < 0) {
445d3bed75de408 Inki Dae 2021-05-25 899 dev_err(g2d->dev, "failed to enable G2D device.\n");
445d3bed75de408 Inki Dae 2021-05-25 900 return;

mutex_unlock(&g2d->runqueue_mutex);

445d3bed75de408 Inki Dae 2021-05-25 901 }
445d3bed75de408 Inki Dae 2021-05-25 902
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 903 g2d_dma_start(g2d, g2d->runqueue_node);
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 904 }
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 905 }
22d6704dd4bf2c8 Tobias Jakobi 2016-09-27 906
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 @907 mutex_unlock(&g2d->runqueue_mutex);
d7f1642c90ab5eb Joonyoung Shim 2012-05-17 908 }

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

_______________________________________________
kbuild mailing list -- kbuild@xxxxxxxxxxxx
To unsubscribe send an email to kbuild-leave@xxxxxxxxxxxx