[PATCH 5/7] net: mctp: usblib: Simplify allocation logic in mctp_usblib_test_rx_init

From: James Lee

Date: Sun Aug 30 2026 - 23:45:25 EST


The if statement testing rx's allocation is unneeded.

Signed-off-by: James Lee <james@xxxxxxxxxxxxxxxxxxxx>
---
drivers/net/mctp/mctp-usblib-test.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/mctp/mctp-usblib-test.c b/drivers/net/mctp/mctp-usblib-test.c
index ab323a31161a415d93eafe4314e0e52cedfcd42e..772484df32a7d7b4d30e51808e06853febe272b6 100644
--- a/drivers/net/mctp/mctp-usblib-test.c
+++ b/drivers/net/mctp/mctp-usblib-test.c
@@ -202,11 +202,9 @@ mctp_usblib_test_rx_init(struct kunit *test, bool span)
int rc;

rx = kzalloc_obj(*rx);
- if (rx) {
- rc = kunit_add_action_or_reset(test, action_rx_fini, rx);
- KUNIT_ASSERT_EQ(test, rc, 0);
- }
KUNIT_ASSERT_NOT_NULL(test, rx);
+ rc = kunit_add_action_or_reset(test, action_rx_fini, rx);
+ KUNIT_ASSERT_EQ(test, rc, 0);

rc = mctp_usblib_rx_init(rx, ep_maxpacket, span);
KUNIT_ASSERT_EQ(test, rc, 0);

--
2.47.3