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

Commit 5d1a7fd7 authored by David Kershner's avatar David Kershner Committed by Greg Kroah-Hartman
Browse files

staging: unisys: visorbus: clean up initializations



Don't compute value of offset during initialization. Assigning a value to
offset should happen after we have verified all of its components.

Signed-off-by: default avatarDavid Kershner <david.kershner@unisys.com>
Reviewed-by: default avatarTim Sell <timothy.sell@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9f1d28fa
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -743,11 +743,12 @@ static void write_vbus_chp_info(struct visorchannel *chan,
				struct visor_vbus_headerinfo *hdr_info,
				struct visor_vbus_deviceinfo *info)
{
	int off = sizeof(struct channel_header) + hdr_info->chp_info_offset;
	int off;

	if (hdr_info->chp_info_offset == 0)
		return;

	off = sizeof(struct channel_header) + hdr_info->chp_info_offset;
	visorchannel_write(chan, off, info, sizeof(*info));
}

@@ -768,11 +769,11 @@ static void write_vbus_bus_info(struct visorchannel *chan,
				struct visor_vbus_headerinfo *hdr_info,
				struct visor_vbus_deviceinfo *info)
{
	int off = sizeof(struct channel_header) + hdr_info->bus_info_offset;
	int off;

	if (hdr_info->bus_info_offset == 0)
		return;

	off = sizeof(struct channel_header) + hdr_info->bus_info_offset;
	visorchannel_write(chan, off, info, sizeof(*info));
}

@@ -795,13 +796,12 @@ static void write_vbus_dev_info(struct visorchannel *chan,
				struct visor_vbus_deviceinfo *info,
				unsigned int devix)
{
	int off =
	    (sizeof(struct channel_header) + hdr_info->dev_info_offset) +
	    (hdr_info->device_info_struct_bytes * devix);
	int off;

	if (hdr_info->dev_info_offset == 0)
		return;

	off = (sizeof(struct channel_header) + hdr_info->dev_info_offset) +
	      (hdr_info->device_info_struct_bytes * devix);
	visorchannel_write(chan, off, info, sizeof(*info));
}