OSDN Git Service

soc: qcom: subsystem_notif_virt: Add a NULL check and fix a data type
authorAnant Goel <anantg@codeaurora.org>
Mon, 8 Oct 2018 18:06:13 +0000 (11:06 -0700)
committerAnant Goel <anantg@codeaurora.org>
Tue, 9 Oct 2018 05:37:11 +0000 (22:37 -0700)
A NULL pointer check is added to prevent a NULL pointer
exception. A data type is fixed to prevent a type conversion
before an error check.

Change-Id: If4f6f70c8770ad48432e466e1b6a7e9bf4b62258
Signed-off-by: Anant Goel <anantg@codeaurora.org>
drivers/soc/qcom/subsystem_notif_virt.c

index f8ce53c..5c9acf7 100644 (file)
@@ -43,7 +43,7 @@ struct subsystem_descriptor {
        enum subsystem_type type;
        struct notifier_block nb;
        void *handle;
-       unsigned int ssr_irq;
+       int ssr_irq;
        struct list_head subsystem_list;
        struct work_struct work;
 };
@@ -91,7 +91,7 @@ static int subsys_notif_virt_probe(struct platform_device *pdev)
        struct device_node *child = NULL;
        const char *ss_type;
        struct resource *res;
-       struct subsystem_descriptor *subsystem;
+       struct subsystem_descriptor *subsystem = NULL;
        int ret = 0;
 
        if (!pdev) {
@@ -193,7 +193,8 @@ static int subsys_notif_virt_probe(struct platform_device *pdev)
                }
        }
 
-       INIT_WORK(&subsystem->work, subsystem_notif_wq_func);
+       if (subsystem)
+               INIT_WORK(&subsystem->work, subsystem_notif_wq_func);
        return 0;
 err:
        destroy_workqueue(ssr_wq);