Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1289398

Re: [PATCH 2/4] scsi: storvsc: Properly support Fibre Channel devices

From Dan Carpenter <dan.carpenter@oracle.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/4] scsi: storvsc: Properly support Fibre Channel devices
Date 2015-12-11 11:30 +0100
Message-ID <qEt7A-2X2-31@gated-at.bofh.it> (permalink)
References <qEic9-3Yp-7@gated-at.bofh.it> <qEic9-3Yp-11@gated-at.bofh.it> <qEicb-3Yp-53@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Dec 10, 2015 at 04:14:18PM -0800, K. Y. Srinivasan wrote:
> +	ret = vmbus_sendpacket(device->channel, vstor_packet,
> +			       (sizeof(struct vstor_packet) -
> +			       vmscsi_size_delta),
> +			       (unsigned long)request,
> +			       VM_PKT_DATA_INBAND,
> +			       VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
> +
> +	if (ret != 0)
> +		goto cleanup;
> +
> +	t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
> +	if (t == 0) {
> +		ret = -ETIMEDOUT;
> +		goto cleanup;
> +	}
> +
> +	if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
> +	    vstor_packet->status != 0)
> +		goto cleanup;

"cleanup" is a misleading name because it doesn't clean up anything.
Do nothing gotos are a pain in the butt and they always introduce bugs.
For example, you appear to have forgotten to set the error code.  But
because it's a do-nothing goto it's ambiguous so perhaps returning
success was intended.

Empirically this style of coding causes bugs.  It does not prevent them.
It is a bad style if you believe in measuring, evidence and science.

regards,
dan carpenter

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] scsi: storvsc: Fix a bug in the layout of the hv_fc_wwn_packet "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-10 23:50 +0100
  [PATCH 4/4] scsi: storvsc: Tighten up the interrupt path "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-10 23:50 +0100
    Re: [PATCH 4/4] scsi: storvsc: Tighten up the interrupt path Johannes Thumshirn <jthumshirn@suse.de> - 2015-12-11 10:20 +0100
  [PATCH 3/4] scsi: storvsc: Refactor the code in storvsc_channel_init() "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-10 23:50 +0100
    Re: [PATCH 3/4] scsi: storvsc: Refactor the code in  storvsc_channel_init() Johannes Thumshirn <jthumshirn@suse.de> - 2015-12-11 10:10 +0100
    Re: [PATCH 3/4] scsi: storvsc: Refactor the code in  storvsc_channel_init() Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-11 11:50 +0100
  [PATCH 2/4] scsi: storvsc: Properly support Fibre Channel devices "K. Y. Srinivasan" <kys@microsoft.com> - 2015-12-10 23:50 +0100
    Re: [PATCH 2/4] scsi: storvsc: Properly support Fibre Channel devices Johannes Thumshirn <jthumshirn@suse.de> - 2015-12-11 10:00 +0100
    Re: [PATCH 2/4] scsi: storvsc: Properly support Fibre Channel devices Dan Carpenter <dan.carpenter@oracle.com> - 2015-12-11 11:30 +0100
  Re: [PATCH 1/4] scsi: storvsc: Fix a bug in the layout of the  hv_fc_wwn_packet Johannes Thumshirn <jthumshirn@suse.de> - 2015-12-11 09:50 +0100

csiph-web