Skip to content

Commit d0f6dc2

Browse files
q2venkuba-moo
authored andcommitted
af_unix: Replace BUG_ON() with WARN_ON_ONCE().
This is a prep patch for the last patch in this series so that checkpatch will not warn about BUG_ON(). Signed-off-by: Kuniyuki Iwashima <[email protected]> Acked-by: Jens Axboe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 2dc23b6 commit d0f6dc2

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

net/unix/garbage.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static void scan_children(struct sock *x, void (*func)(struct unix_sock *),
145145
/* An embryo cannot be in-flight, so it's safe
146146
* to use the list link.
147147
*/
148-
BUG_ON(!list_empty(&u->link));
148+
WARN_ON_ONCE(!list_empty(&u->link));
149149
list_add_tail(&u->link, &embryos);
150150
}
151151
spin_unlock(&x->sk_receive_queue.lock);
@@ -213,8 +213,8 @@ static void __unix_gc(struct work_struct *work)
213213

214214
total_refs = file_count(u->sk.sk_socket->file);
215215

216-
BUG_ON(!u->inflight);
217-
BUG_ON(total_refs < u->inflight);
216+
WARN_ON_ONCE(!u->inflight);
217+
WARN_ON_ONCE(total_refs < u->inflight);
218218
if (total_refs == u->inflight) {
219219
list_move_tail(&u->link, &gc_candidates);
220220
__set_bit(UNIX_GC_CANDIDATE, &u->gc_flags);
@@ -294,7 +294,7 @@ static void __unix_gc(struct work_struct *work)
294294
list_move_tail(&u->link, &gc_inflight_list);
295295

296296
/* All candidates should have been detached by now. */
297-
BUG_ON(!list_empty(&gc_candidates));
297+
WARN_ON_ONCE(!list_empty(&gc_candidates));
298298

299299
/* Paired with READ_ONCE() in wait_for_unix_gc(). */
300300
WRITE_ONCE(gc_in_progress, false);

net/unix/scm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ void unix_inflight(struct user_struct *user, struct file *fp)
5151

5252
if (u) {
5353
if (!u->inflight) {
54-
BUG_ON(!list_empty(&u->link));
54+
WARN_ON_ONCE(!list_empty(&u->link));
5555
list_add_tail(&u->link, &gc_inflight_list);
5656
} else {
57-
BUG_ON(list_empty(&u->link));
57+
WARN_ON_ONCE(list_empty(&u->link));
5858
}
5959
u->inflight++;
6060
/* Paired with READ_ONCE() in wait_for_unix_gc() */
@@ -71,8 +71,8 @@ void unix_notinflight(struct user_struct *user, struct file *fp)
7171
spin_lock(&unix_gc_lock);
7272

7373
if (u) {
74-
BUG_ON(!u->inflight);
75-
BUG_ON(list_empty(&u->link));
74+
WARN_ON_ONCE(!u->inflight);
75+
WARN_ON_ONCE(list_empty(&u->link));
7676

7777
u->inflight--;
7878
if (!u->inflight)

0 commit comments

Comments
 (0)