aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/ibmasm/module.c
diff options
context:
space:
mode:
authorAnton Vasilyev <vasilyev@ispras.ru>2017-08-01 09:25:59 -0400
committerJiri Kosina <jkosina@suse.cz>2017-10-12 09:37:19 -0400
commitf403f85f5334fb169d5c00deac106f140b62d3c9 (patch)
tree15600778f839c182c1dfd8bd4fa37f7cf0ff2d5b /drivers/misc/ibmasm/module.c
parentdf47b246ed176b504b1d50ad63aa5a3bf7551f82 (diff)
misc: ibmasm: Return error on error path
If ibmasm_event_buffer_init() or ibmasm_heartbeat_init() fails, then ibmasm_init_one() release all resources and return 0 on error path. The patch adds corresponding error for fails. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Anton Vasilyev <vasilyev@ispras.ru> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/misc/ibmasm/module.c')
-rw-r--r--drivers/misc/ibmasm/module.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/misc/ibmasm/module.c b/drivers/misc/ibmasm/module.c
index c5a456b0a564..e914b8c80943 100644
--- a/drivers/misc/ibmasm/module.c
+++ b/drivers/misc/ibmasm/module.c
@@ -94,12 +94,14 @@ static int ibmasm_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
94 snprintf(sp->dirname, IBMASM_NAME_SIZE, "%d", sp->number); 94 snprintf(sp->dirname, IBMASM_NAME_SIZE, "%d", sp->number);
95 snprintf(sp->devname, IBMASM_NAME_SIZE, "%s%d", DRIVER_NAME, sp->number); 95 snprintf(sp->devname, IBMASM_NAME_SIZE, "%s%d", DRIVER_NAME, sp->number);
96 96
97 if (ibmasm_event_buffer_init(sp)) { 97 result = ibmasm_event_buffer_init(sp);
98 if (result) {
98 dev_err(sp->dev, "Failed to allocate event buffer\n"); 99 dev_err(sp->dev, "Failed to allocate event buffer\n");
99 goto error_eventbuffer; 100 goto error_eventbuffer;
100 } 101 }
101 102
102 if (ibmasm_heartbeat_init(sp)) { 103 result = ibmasm_heartbeat_init(sp);
104 if (result) {
103 dev_err(sp->dev, "Failed to allocate heartbeat command\n"); 105 dev_err(sp->dev, "Failed to allocate heartbeat command\n");
104 goto error_heartbeat; 106 goto error_heartbeat;
105 } 107 }