]> Git Repo - linux.git/commitdiff
drm: msm: Check cmd_db_read_aux_data() for failure
authorStephen Boyd <[email protected]>
Thu, 29 Nov 2018 16:38:26 +0000 (08:38 -0800)
committerAndy Gross <[email protected]>
Thu, 29 Nov 2018 23:41:53 +0000 (17:41 -0600)
We need to check the call to cmd_db_read_aux_data() for the error case,
so that we don't continue and use potentially uninitialized values for
'pri_count' and 'sec_count'. Otherwise, we get the following compiler
warnings:

   drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_rpmh_arc_votes_init.isra.12':
   drivers/gpu/drm/msm/adreno/a6xx_gmu.c:943:12: warning: 'pri_count' is used uninitialized in this function [-Wuninitialized]
     pri_count >>= 1;
               ^~~
   drivers/gpu/drm/msm/adreno/a6xx_gmu.c:948:12: warning: 'sec_count' may be used uninitialized in this function
[-Wmaybe-uninitialized]
     sec_count >>= 1;
               ^~~

Reported-by: Stephen Rothwell <[email protected]>
Reported-by: kbuild test robot <[email protected]>
Cc: Jordan Crouse <[email protected]>
Cc: Bjorn Andersson <[email protected]>
Cc: Evan Green <[email protected]>
Cc: Jordan Crouse <[email protected]>
Cc: Rob Clark <[email protected]>
Fixes: ed3cafa79ea7 ("soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data()")
Signed-off-by: Stephen Boyd <[email protected]>
Reviewed-by: Andy Gross <[email protected]>
Acked-by: Rob Clark <[email protected]>
Signed-off-by: Andy Gross <[email protected]>
drivers/gpu/drm/msm/adreno/a6xx_gmu.c

index 546599a7ab05d5fc3355e0b1056191ab5e137e93..0fb4718ef0df9c9ba7cfa72f71f0da952f9fb2c7 100644 (file)
@@ -936,6 +936,8 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes,
        size_t pri_count, sec_count;
 
        pri = cmd_db_read_aux_data(id, &pri_count);
+       if (IS_ERR(pri))
+               return PTR_ERR(pri);
        /*
         * The data comes back as an array of unsigned shorts so adjust the
         * count accordingly
@@ -945,6 +947,9 @@ static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes,
                return -EINVAL;
 
        sec = cmd_db_read_aux_data("mx.lvl", &sec_count);
+       if (IS_ERR(sec))
+               return PTR_ERR(sec);
+
        sec_count >>= 1;
        if (!sec_count)
                return -EINVAL;
This page took 0.074364 seconds and 4 git commands to generate.