Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e6f86da authored by Pratham Pratap's avatar Pratham Pratap
Browse files

usb: gsi: Add NULL pointer check



Static code analysis tool is detecting a possible NULL pointer
dereference for gsi->d_port.in_ep in the error handling path.
This change adds a NULL pointer check to avoid this issue.

Change-Id: I4adf03e933cece0698cd3761c8758f4bd98925f4
Signed-off-by: default avatarPratham Pratap <prathampratap@codeaurora.org>
parent 84b56d3a
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/module.h>
@@ -859,8 +859,10 @@ static int gsi_ep_enable(struct f_gsi *gsi)
		ret = usb_gsi_ep_op(gsi->d_port.out_ep,
				&gsi->d_port.out_request, GSI_EP_OP_CONFIG);
		if (ret) {
			if (gsi->d_port.in_ep)
				usb_gsi_ep_op(gsi->d_port.in_ep,
				&gsi->d_port.in_request, GSI_EP_OP_DISABLE);
					&gsi->d_port.in_request,
					GSI_EP_OP_DISABLE);
			return ret;
		}
	}