lkml.org 
[lkml]   [2018]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 16/18] staging: gasket: gasket core error handling fixups
Date
From: Todd Poynor <toddpoynor@google.com>

Minor fixups to error codes and error handling in gasket core.

No device reset callback registered is not an error condition.

Signed-off-by: Simon Que <sque@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
---
drivers/staging/gasket/gasket_core.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c b/drivers/staging/gasket/gasket_core.c
index 0ef37667e0f1..65780d4dffbf 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -814,7 +814,7 @@ static int gasket_map_pci_bar(struct gasket_dev *gasket_dev, int bar_num)
gasket_dev,
"Cannot get BAR %d memory region %p",
bar_num, &gasket_dev->pci_dev->resource[bar_num]);
- return -EINVAL;
+ return -EBUSY;
}

gasket_dev->bar_data[bar_num].virt_base =
@@ -1655,7 +1655,7 @@ static int gasket_mmap(struct file *filp, struct vm_area_struct *vma)
"0x%lx",
raw_offset);
trace_gasket_mmap_exit(bar_index);
- return bar_index;
+ return -EINVAL;
}

vma->vm_private_data = gasket_dev;
@@ -1865,11 +1865,8 @@ int gasket_reset_nolock(struct gasket_dev *gasket_dev, uint reset_type)
const struct gasket_driver_desc *driver_desc;

driver_desc = gasket_dev->internal_desc->driver_desc;
- if (!driver_desc->device_reset_cb) {
- gasket_log_error(
- gasket_dev, "No device reset callback was registered.");
- return -EINVAL;
- }
+ if (!driver_desc->device_reset_cb)
+ return 0;

/* Perform a device reset of the requested type. */
ret = driver_desc->device_reset_cb(gasket_dev, reset_type);
@@ -1894,7 +1891,7 @@ int gasket_reset_nolock(struct gasket_dev *gasket_dev, uint reset_type)
gasket_dev->status = gasket_get_hw_status(gasket_dev);
if (gasket_dev->status == GASKET_STATUS_DEAD) {
gasket_log_error(gasket_dev, "Device reported as dead.");
- return -EINVAL;
+ return -EIO;
}

return 0;
--
2.18.0.203.gfac676dfb9-goog
\
 
 \ /
  Last update: 2018-07-15 22:07    [W:0.210 / U:0.472 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site