public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: Oren Weil <oren.jer.weil@intel.com>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	alan@linux.intel.com, david@woodhou.se
Subject: Re: [PATCH 3/8] staging/mei: MEI "Link" layer code - MEI Hardware communications.
Date: Wed, 27 Apr 2011 08:18:33 -0700	[thread overview]
Message-ID: <20110427151833.GF24596@suse.de> (raw)
In-Reply-To: <1303900057-21694-4-git-send-email-oren.jer.weil@intel.com>

On Wed, Apr 27, 2011 at 01:27:32PM +0300, Oren Weil wrote:
> +/**
> + * mei_flow_ctrl_creds - checks flow_control credentials.
> + *
> + * @dev: the device structure
> + * @file_ext: private data of the file object
> + *
> + * returns 1 if mei_flow_ctrl_creds >0, 0 - otherwise.
> + */
> +int mei_flow_ctrl_creds(struct mei_device *dev, struct mei_cl *file_ext)
> +{
> +	int i;
> +
> +	if (!dev->num_mei_me_clients)
> +		return 0;
> +
> +	if (file_ext == NULL)
> +		return 0;
> +
> +	if (file_ext->mei_flow_ctrl_creds > 0)
> +		return 1;
> +
> +	for (i = 0; i < dev->num_mei_me_clients; i++) {
> +		if (dev->me_clients[i].client_id == file_ext->me_client_id) {
> +			if (dev->me_clients[i].mei_flow_ctrl_creds > 0) {
> +				BUG_ON(dev->me_clients[i].props.single_recv_buf
> +					 == 0);
> +				return 1;
> +			}
> +			return 0;
> +		}
> +	}
> +	BUG();
> +	return 0;

What?

You just crashed your device with no chance of recovery.  NEVER put a
BUG() or BUG_ON() call in a driver, that is just rude in irresponsible.

Especially with a return 0; after it, that's just trying to outsmart the
compiler warning, which is extra foolish.

This happens in other places in this code as well, please fix.

greg k-h

  reply	other threads:[~2011-04-27 15:18 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27 10:27 [PATCH 0/8] staging/mei: Intel MEI Driver Oren Weil
2011-04-27 10:27 ` [PATCH 1/8] staging/mei: PCI device and char driver support Oren Weil
2011-04-27 12:24   ` Jiri Slaby
2011-04-27 15:05   ` Greg KH
2011-04-28  5:47     ` Weil, Oren jer
2011-04-28 13:37       ` Greg KH
2011-04-27 10:27 ` [PATCH 2/8] staging/mei: Interrupt handling Oren Weil
2011-04-27 10:27 ` [PATCH 3/8] staging/mei: MEI "Link" layer code - MEI Hardware communications Oren Weil
2011-04-27 15:18   ` Greg KH [this message]
2011-04-27 10:27 ` [PATCH 4/8] staging/mei: MEI driver init flow Oren Weil
2011-04-27 10:27 ` [PATCH 5/8] staging/mei: Hardware and MEI driver internal struct definition Oren Weil
2011-04-27 10:27 ` [PATCH 6/8] staging/mei: Header file contain the Userland API, (IOCTL and its struct) Oren Weil
2011-04-27 15:02   ` Greg KH
2011-04-27 15:15   ` Randy Dunlap
2011-04-27 15:33     ` Greg KH
2011-04-28  6:29       ` Weil, Oren jer
2011-04-28 13:40         ` Greg KH
2011-04-28 14:12           ` Weil, Oren jer
2011-04-28 15:04             ` Greg KH
2011-04-28 15:39               ` David Woodhouse
2011-04-28 14:43           ` Alan Cox
2011-04-27 10:27 ` [PATCH 7/8] staging/mei: AMT Watchdog Oren Weil
2011-04-27 13:53   ` Arnd Bergmann
2011-04-27 15:07     ` Greg KH
2011-04-28  5:51       ` Weil, Oren jer
2011-04-28 12:50         ` Arnd Bergmann
2011-04-28 13:38         ` Greg KH
2011-04-27 10:27 ` [PATCH 8/8] staging/mei: Updates to staging/Kconfig ane staging/Makefile and a new Makefile and Kconfig Oren Weil
2011-04-27 15:06   ` Greg KH
2011-04-28  6:39     ` Weil, Oren jer
2011-04-28  8:22       ` Alan Cox
2011-04-27 15:19   ` Randy Dunlap
2011-04-28  0:05   ` Valdis.Kletnieks
2011-04-27 15:03 ` [PATCH 0/8] staging/mei: Intel MEI Driver Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110427151833.GF24596@suse.de \
    --to=gregkh@suse.de \
    --cc=alan@linux.intel.com \
    --cc=david@woodhou.se \
    --cc=devel@driverdev.osuosl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oren.jer.weil@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox