Commit e8f9071
vfio: Make vfio_unpin_pages() return void
There's only one caller that checks its return value with a WARN_ON_ONCE,
while all other callers don't check the return value at all. Above that,
an undo function should not fail. So, simplify the API to return void by
embedding similar WARN_ONs.
Also for users to pinpoint which condition fails, separate WARN_ON lines,
yet remove the "driver->ops->unpin_pages" check, since it's unreasonable
for callers to unpin on something totally random that wasn't even pinned.
And remove NULL pointer checks for they would trigger oops vs. warnings.
Note that npage is already validated in the vfio core, thus drop the same
check in the type1 code.
Suggested-by: Christoph Hellwig <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Jason Gunthorpe <[email protected]>
Reviewed-by: Kirti Wankhede <[email protected]>
Tested-by: Terrence Xu <[email protected]>
Signed-off-by: Nicolin Chen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alex Williamson <[email protected]>1 parent 9cb633a commit e8f9071
File tree
6 files changed
+18
-31
lines changed- Documentation/driver-api
- drivers
- gpu/drm/i915/gvt
- vfio
- include/linux
6 files changed
+18
-31
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
268 | | - | |
| 268 | + | |
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
235 | 234 | | |
236 | 235 | | |
237 | | - | |
238 | 236 | | |
239 | 237 | | |
240 | 238 | | |
241 | 239 | | |
242 | 240 | | |
243 | 241 | | |
244 | | - | |
245 | | - | |
| 242 | + | |
246 | 243 | | |
247 | 244 | | |
248 | 245 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1983 | 1983 | | |
1984 | 1984 | | |
1985 | 1985 | | |
1986 | | - | |
1987 | 1986 | | |
1988 | | - | |
1989 | | - | |
| 1987 | + | |
| 1988 | + | |
1990 | 1989 | | |
1991 | 1990 | | |
1992 | 1991 | | |
1993 | | - | |
1994 | 1992 | | |
1995 | | - | |
1996 | | - | |
| 1993 | + | |
| 1994 | + | |
1997 | 1995 | | |
1998 | | - | |
1999 | | - | |
| 1996 | + | |
| 1997 | + | |
2000 | 1998 | | |
2001 | 1999 | | |
2002 | 2000 | | |
2003 | 2001 | | |
2004 | | - | |
2005 | | - | |
2006 | | - | |
2007 | | - | |
2008 | | - | |
2009 | 2002 | | |
2010 | | - | |
| 2003 | + | |
2011 | 2004 | | |
2012 | 2005 | | |
2013 | 2006 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
949 | 949 | | |
950 | 950 | | |
951 | 951 | | |
952 | | - | |
953 | | - | |
954 | | - | |
| 952 | + | |
| 953 | + | |
955 | 954 | | |
956 | 955 | | |
957 | 956 | | |
958 | 957 | | |
959 | 958 | | |
960 | | - | |
961 | | - | |
962 | | - | |
963 | 959 | | |
964 | | - | |
965 | | - | |
| 960 | + | |
| 961 | + | |
966 | 962 | | |
967 | 963 | | |
968 | 964 | | |
| |||
980 | 976 | | |
981 | 977 | | |
982 | 978 | | |
983 | | - | |
| 979 | + | |
| 980 | + | |
984 | 981 | | |
985 | 982 | | |
986 | 983 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
166 | | - | |
167 | | - | |
| 166 | + | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
0 commit comments