public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Buesch <mb@bu3sch.de>
To: "Rakib Mullick" <rakib.mullick@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drivers/gpio/bt8xxgpio.c Fix compilation warning.
Date: Thu, 2 Oct 2008 10:22:12 +0200	[thread overview]
Message-ID: <200810021022.13252.mb@bu3sch.de> (raw)
In-Reply-To: <b9df5fa10810012359oac41498sf716ce51b39a36ce@mail.gmail.com>

On Thursday 02 October 2008 08:59:11 Rakib Mullick wrote:
> drivers/gpio/bt8xxgpio.c: In function `bt8xxgpio_remove':
> drivers/gpio/bt8xxgpio.c:247: warning: ignoring return value of
> `gpiochip_remove', declared with attribute warn_unused_result
> 
> Following patch removes the above warning.
> Thanks.
> 
> Signed-off-by:	Md.Rakib H. Mullick (rakib.mullick@gmail.com)
> 
> --- linux-2.6.27-rc8.orig/drivers/gpio/bt8xxgpio.c	2008-10-01
> 19:20:59.000000000 +0600
> +++ linux-2.6.27-rc8/drivers/gpio/bt8xxgpio.c	2008-10-02
> 12:30:26.374544032 +0600
> @@ -242,9 +242,14 @@ err_freebg:
> 
>  static void bt8xxgpio_remove(struct pci_dev *pdev)
>  {
> +	int err;
>  	struct bt8xxgpio *bg = pci_get_drvdata(pdev);
> 
> -	gpiochip_remove(&bg->gpio);
> +	err = gpiochip_remove(&bg->gpio);
> +	if (err) {
> +		printk(KERN_ERR "bt8xxgpio: Resource busy. Failed to remove.\n");
> +		return ;
> +	}
> 
>  	bgwrite(0, BT848_INT_MASK);
>  	bgwrite(~0x0, BT848_INT_STAT);
> 
> 

NACK.
gpiolib should be fixed.
It is impossible to handle this case. What your patch does is to leave the device
in an inconsistent state, if the gpio remove fails.

gpiolib is broken. It should not allow failure for the remove function, as most
callers cannot handle it. gpiolib should force-remove any users of the gpio line,
if the chip driver removes the chip. That's really the only way we can fix this.
Breaking the driver (to leak resources or leave the device in an inconsistent state)
just to get rid of a bogus warning is not the right fix.
Please ignore this warning for now.

-- 
Greetings Michael.

  reply	other threads:[~2008-10-02  8:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-02  6:59 [PATCH] drivers/gpio/bt8xxgpio.c Fix compilation warning Rakib Mullick
2008-10-02  8:22 ` Michael Buesch [this message]
2008-10-02 13:39   ` Rakib Mullick

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=200810021022.13252.mb@bu3sch.de \
    --to=mb@bu3sch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rakib.mullick@gmail.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