| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2017 Joe Lawrence <joe.lawrence@redhat.com> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or |
|---|
| 5 | | - * modify it under the terms of the GNU General Public License |
|---|
| 6 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 7 | | - * of the License, or (at your option) any later version. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License |
|---|
| 15 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
|---|
| 16 | 4 | */ |
|---|
| 17 | 5 | |
|---|
| 18 | 6 | /* |
|---|
| .. | .. |
|---|
| 195 | 183 | |
|---|
| 196 | 184 | static int livepatch_callbacks_demo_init(void) |
|---|
| 197 | 185 | { |
|---|
| 198 | | - int ret; |
|---|
| 199 | | - |
|---|
| 200 | | - ret = klp_register_patch(&patch); |
|---|
| 201 | | - if (ret) |
|---|
| 202 | | - return ret; |
|---|
| 203 | | - ret = klp_enable_patch(&patch); |
|---|
| 204 | | - if (ret) { |
|---|
| 205 | | - WARN_ON(klp_unregister_patch(&patch)); |
|---|
| 206 | | - return ret; |
|---|
| 207 | | - } |
|---|
| 208 | | - return 0; |
|---|
| 186 | + return klp_enable_patch(&patch); |
|---|
| 209 | 187 | } |
|---|
| 210 | 188 | |
|---|
| 211 | 189 | static void livepatch_callbacks_demo_exit(void) |
|---|
| 212 | 190 | { |
|---|
| 213 | | - WARN_ON(klp_unregister_patch(&patch)); |
|---|
| 214 | 191 | } |
|---|
| 215 | 192 | |
|---|
| 216 | 193 | module_init(livepatch_callbacks_demo_init); |
|---|