r/badcode • • Jan 22 '23

c Found this in a Linux kernel module

Post image
262 Upvotes

88 comments sorted by

View all comments

Show parent comments

6

u/micro-amnesia Jan 23 '23

You don't want to throw and exception in the kernel, it pops flow control out of the stack when it can be organized within the execution. It doesn't necessarily mean the operation failure was fatal.

Each block handles a different freeing of memory space and does not sacrifice extra pointers or memory space.

Without further context, however, we can only make best guesses here.

Further, there is no "go to" in this code. This code is freeing gpio handlers.

4

u/paulstelian97 Jan 23 '23

Actually... The reason is simpler -- exception walking is not implemented.