.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * livepatch-sample.c - Kernel Live Patching Sample Module |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2014 Seth Jennings <sjenning@redhat.com> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or |
---|
7 | | - * modify it under the terms of the GNU General Public License |
---|
8 | | - * as published by the Free Software Foundation; either version 2 |
---|
9 | | - * of the License, or (at your option) any later version. |
---|
10 | | - * |
---|
11 | | - * This program is distributed in the hope that it will be useful, |
---|
12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | | - * GNU General Public License for more details. |
---|
15 | | - * |
---|
16 | | - * You should have received a copy of the GNU General Public License |
---|
17 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
---|
18 | 6 | */ |
---|
19 | 7 | |
---|
20 | 8 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
.. | .. |
---|
69 | 57 | |
---|
70 | 58 | static int livepatch_init(void) |
---|
71 | 59 | { |
---|
72 | | - int ret; |
---|
73 | | - |
---|
74 | | - ret = klp_register_patch(&patch); |
---|
75 | | - if (ret) |
---|
76 | | - return ret; |
---|
77 | | - ret = klp_enable_patch(&patch); |
---|
78 | | - if (ret) { |
---|
79 | | - WARN_ON(klp_unregister_patch(&patch)); |
---|
80 | | - return ret; |
---|
81 | | - } |
---|
82 | | - return 0; |
---|
| 60 | + return klp_enable_patch(&patch); |
---|
83 | 61 | } |
---|
84 | 62 | |
---|
85 | 63 | static void livepatch_exit(void) |
---|
86 | 64 | { |
---|
87 | | - WARN_ON(klp_unregister_patch(&patch)); |
---|
88 | 65 | } |
---|
89 | 66 | |
---|
90 | 67 | module_init(livepatch_init); |
---|