[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240529131953.195777-1-warthog618@gmail.com>
Date: Wed, 29 May 2024 21:19:50 +0800
From: Kent Gibson <warthog618@...il.com>
To: linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org,
brgl@...ev.pl,
linus.walleij@...aro.org
Cc: Kent Gibson <warthog618@...il.com>
Subject: [PATCH v2 0/3] gpiolib: cdev: tidy up kfifo handling
This series is a follow up to my recent kfifo initialisation fix[1].
Patch 1 adds calling INIT_KFIFO() on the event kfifo in order to induce
an oops if the kfifo is accessed prior to being allocated. Not calling
INIT_KFIFO() could be considered an abuse of the kfifo API. I don't
recall, but it is possible that it was not being called as we also make
use of kfifo_initialized(), and the assumption was that it would return
true after the INIT_KFIFO() call. In fact it only returns true once
the kfifo has been allocated.
Patch 2 adds a helper to perform the allocation of the kfifo to reduce
code duplication.
Patch 3 tidies up the handling of kfifo_out() errors, making them
visible where they may currently be obscured. These errors are not
expected to ever happen, so this should not produce any visible
difference, but if they do occur it will now be more obvious.
Cheers,
Kent.
Changes v1 -> v2:
- add WARN() to patch 3.
Kent Gibson (3):
gpiolib: cdev: Add INIT_KFIFO() for linereq events
gpiolib: cdev: Refactor allocation of linereq events kfifo
gpiolib: cdev: Cleanup kfifo_out() error handling
drivers/gpio/gpiolib-cdev.c | 80 +++++++++++++++++++------------------
1 file changed, 41 insertions(+), 39 deletions(-)
--
2.39.2
Powered by blists - more mailing lists