All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Lukas Wunner <lukas@wunner.de>,
	Marcel Holtmann <marcel@holtmann.org>,
	Johan Hedberg <johan.hedberg@gmail.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
	Frederic Danis <frederic.danis.oss@gmail.com>,
	Loic Poulain <loic.poulain@linaro.org>,
	Hans de Goede <hdegoede@redhat.com>, Max Shavrick <mxms@me.com>,
	Leif Liddy <leif.liddy@gmail.com>,
	Daniel Roschka <danielroschka@phoenitydawn.de>,
	Ronald Tschalaer <ronald@innovation.ch>,
	"Peter Y. Chuang" <peteryuchuang@gmail.com>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH v2 09/10] Bluetooth: hci_bcm: Handle errors properly
Date: Wed, 03 Jan 2018 18:08:42 +0200	[thread overview]
Message-ID: <1514995722.7000.578.camel@linux.intel.com> (raw)
In-Reply-To: <a91a911d570345ea15935f3db8ddd66aa8986661.1514916630.git.lukas@wunner.de>

On Tue, 2018-01-02 at 20:08 +0100, Lukas Wunner wrote:
> A significant portion of this driver lacks error handling.  As a first
> step, add error paths to bcm_gpio_set_power(), bcm_open(),
> bcm_close(),
> bcm_suspend_device(), bcm_resume_device(), bcm_resume(), bcm_probe()
> and
> bcm_serdev_probe().  (I've also scrutinized bcm_suspend() but think
> it's
> fine as is.)
> 
> Those are all the functions accessing the device wake and shutdown
> GPIO.
> On Apple Macs the pins are accessed through ACPI methods, which may
> fail
> for various reasons, hence proper error handling is necessary.  Non-
> Macs
> access the pins directly, which may fail as well but the GPIO core
> does
> not yet pass back errors to consumers.
> 

> +	int err = 0;

Obviously redundant assignment.

> +
> +	if (powered && !IS_ERR(dev->clk) && !dev->clk_enabled) {
> +		err = clk_prepare_enable(dev->clk);
> +		if (err)
> +			return err;
> +	}
>  
>  	gpiod_set_value(dev->shutdown, powered);

> +	err = bcm_gpio_set_device_wakeup(dev, powered);
> +	if (err)
> +		goto err_revert_shutdown;

> +#ifdef CONFIG_PM
> +	bcm->dev->hu = NULL;
> +#endif

Hmm... There is no field in !PM case?

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

  reply	other threads:[~2018-01-03 16:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-02 19:08 [PATCH v2 00/10] Bluetooth on 2015+ MacBook (Pro) Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 02/10] Bluetooth: hci_bcm: Mandate presence of shutdown and device wake GPIO Lukas Wunner
2018-01-03 12:55   ` Marcel Holtmann
2018-01-02 19:08 ` [PATCH v2 03/10] Bluetooth: hci_bcm: Enable runtime PM despite absence of IRQ Lukas Wunner
2018-01-02 19:17   ` Hans de Goede
2018-01-02 23:36     ` Lukas Wunner
2018-01-03  8:07       ` Hans de Goede
2018-01-03 13:34         ` Lukas Wunner
2018-01-03 12:34       ` Marcel Holtmann
2018-01-03 13:22         ` Lukas Wunner
2018-01-03 13:29           ` Marcel Holtmann
2018-01-03 13:34             ` Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 10/10] Bluetooth: hci_bcm: Support Apple GPIO handling Lukas Wunner
2018-01-03 12:55   ` Marcel Holtmann
2018-01-03 16:12   ` Andy Shevchenko
2018-01-02 19:08 ` [PATCH v2 01/10] Bluetooth: Depend on rather than select GPIOLIB Lukas Wunner
2018-01-03  7:52   ` Linus Walleij
2018-01-05 18:27   ` Marcel Holtmann
2018-01-02 19:08 ` [PATCH v2 04/10] Bluetooth: hci_bcm: Validate IRQ before using it Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 05/10] Bluetooth: hci_bcm: Add helper to toggle device wake GPIO Lukas Wunner
2018-01-03 13:06   ` Andy Shevchenko
2018-01-02 19:08 ` [PATCH v2 09/10] Bluetooth: hci_bcm: Handle errors properly Lukas Wunner
2018-01-03 16:08   ` Andy Shevchenko [this message]
2018-01-03 18:54     ` Lukas Wunner
2018-01-03 19:08       ` Andy Shevchenko
2018-01-02 19:08 ` [PATCH v2 08/10] Bluetooth: hci_bcm: Document struct bcm_device Lukas Wunner
2018-01-02 19:08 ` [PATCH v2 06/10] Bluetooth: hci_bcm: Silence IRQ printk Lukas Wunner
2018-01-03 13:08   ` Andy Shevchenko
2018-01-03 13:56     ` Lukas Wunner
2018-01-03 16:05       ` Andy Shevchenko
2018-01-02 19:08 ` [PATCH v2 07/10] Bluetooth: hci_bcm: Clean up unnecessary #ifdef Lukas Wunner

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=1514995722.7000.578.camel@linux.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=danielroschka@phoenitydawn.de \
    --cc=frederic.danis.oss@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=johan.hedberg@gmail.com \
    --cc=leif.liddy@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=lukas@wunner.de \
    --cc=marcel@holtmann.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=mxms@me.com \
    --cc=peteryuchuang@gmail.com \
    --cc=ronald@innovation.ch \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.