From: Richard Gong <[email protected]>

commit  ecc5919628b706ecc57300c7dbea38e59f2bede1 from
https://github.com/altera-opensource/linux-socfpga.git

Service layer makes a SMC call to u-boot for the shared memory. If SMC is
not supported at u-boot, u-boot will return service layer a invalid value
and cause service layer probe failure. Kernel crashes as a result.

This patch is used to enhance service layer driver. So that if u-boot
doesn't support SMC yet, the service layer driver probe will fail without
crashing the kernel.

FPGA configuration will not work in the case which u-boot doesn't support
SMC.

Signed-off-by: Richard Gong <[email protected]>
Signed-off-by: Meng Li <[email protected]>
---
 drivers/misc/intel-service.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/misc/intel-service.c b/drivers/misc/intel-service.c
index 18690b8..c87d9aa 100644
--- a/drivers/misc/intel-service.c
+++ b/drivers/misc/intel-service.c
@@ -194,6 +194,9 @@ struct intel_svc_chan *request_svc_channel_byname(
        int i;
 
        chan = ERR_PTR(-EPROBE_DEFER);
+       if (list_empty(&svc_ctrl))
+               return ERR_PTR(-ENODEV);
+
        controller = list_first_entry(&svc_ctrl,
                                      struct intel_svc_controller, node);
        for (i = 0; i < SVC_NUM_CHANNEL; i++) {
-- 
1.7.9.5

-- 
_______________________________________________
linux-yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to