Commit daf405c8 authored by Jiri Kosina's avatar Jiri Kosina
Browse files

HID: mcp2221: fix usage of tmp variable in mcp2221_raw_event()



In mcp2221_raw_event(), 'tmp' is used only conditionally. Move
the declaration into the conditional block in order to prevent
unused variable warning.

Reported-by: default avatarkernel test robot <lkp@intel.com>
Fixes: 960f9df7 ("HID: mcp2221: add ADC/DAC support via iio subsystem")
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 960f9df7
Loading
Loading
Loading
Loading
+17 −14
Original line number Diff line number Diff line
@@ -731,7 +731,7 @@ static int mcp_get_i2c_eng_state(struct mcp2221 *mcp,
static int mcp2221_raw_event(struct hid_device *hdev,
				struct hid_report *report, u8 *data, int size)
{
	u8 *buf, tmp;
	u8 *buf;
	struct mcp2221 *mcp = hid_get_drvdata(hdev);

	switch (data[0]) {
@@ -875,6 +875,8 @@ static int mcp2221_raw_event(struct hid_device *hdev,
			}

#if IS_REACHABLE(CONFIG_IIO)
			{
				u8 tmp;
				/* DAC scale value */
				tmp = FIELD_GET(GENMASK(7, 6), data[6]);
				if ((data[6] & BIT(5)) && tmp)
@@ -888,6 +890,7 @@ static int mcp2221_raw_event(struct hid_device *hdev,
					mcp->adc_scale = tmp - 1;
				else
					mcp->adc_scale = 0;
			}
#endif

			break;