drm/nouveau/secboot: make sure requested falcons are supported
authorAlexandre Courbot <acourbot@nvidia.com>
Mon, 23 Jan 2017 03:48:09 +0000 (12:48 +0900)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 7 Mar 2017 07:05:11 +0000 (17:05 +1000)
Check at contruction time that we have support for all the LS firmwares
asked by the caller.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/subdev/secboot/acr_r352.c

index b1e56523757584d392a26bb21b03f1a75121bca0..372d29521fd871cc4f9618bf4c80d4423d1306df 100644 (file)
@@ -888,6 +888,13 @@ acr_r352_new_(const struct acr_r352_func *func,
              unsigned long managed_falcons)
 {
        struct acr_r352 *acr;
+       int i;
+
+       /* Check that all requested falcons are supported */
+       for_each_set_bit(i, &managed_falcons, NVKM_SECBOOT_FALCON_END) {
+               if (!func->ls_func[i])
+                       return ERR_PTR(-ENOTSUPP);
+       }
 
        acr = kzalloc(sizeof(*acr), GFP_KERNEL);
        if (!acr)