Commit 9116223b authored by Todd Poynor's avatar Todd Poynor Committed by Greg Kroah-Hartman
Browse files

staging: gasket: apex_clock_gating simplify logic, reduce indentation



Collapse together two checks and return immediately, avoid conditional
indentation for most of function code.

Reported-by: default avatarGuenter Roeck <groeck@chromium.org>
Signed-off-by: default avatarSimon Que <sque@chromium.org>
Signed-off-by: default avatarTodd Poynor <toddpoynor@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e80d8afc
Loading
Loading
Loading
Loading
+20 −23
Original line number Diff line number Diff line
@@ -666,15 +666,13 @@ static long apex_clock_gating(struct gasket_dev *gasket_dev, ulong arg)
{
	struct apex_gate_clock_ioctl ibuf;

	if (bypass_top_level)
	if (bypass_top_level || !allow_sw_clock_gating)
		return 0;

	if (allow_sw_clock_gating) {
	if (copy_from_user(&ibuf, (void __user *)arg, sizeof(ibuf)))
		return -EFAULT;

		gasket_log_error(
			gasket_dev, "%s %llu", __func__, ibuf.enable);
	gasket_log_error(gasket_dev, "%s %llu", __func__, ibuf.enable);

	if (ibuf.enable) {
		/* Quiesce AXI, gate GCB clock. */
@@ -693,7 +691,6 @@ static long apex_clock_gating(struct gasket_dev *gasket_dev, ulong arg)
		    gasket_dev, APEX_BAR_INDEX,
		    APEX_BAR2_REG_AXI_QUIESCE, 0x0, 1, 16);
	}
	}
	return 0;
}