mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Linux Kernel List <linux-kernel@vger.kernel.org>,
	Greg KH <greg@kroah.com>
Subject: [PATCH] Fix i2c_use_client()
Date: Sun, 7 Mar 2004 16:13:41 +0000	[thread overview]
Message-ID: <20040307161341.A7065@flint.arm.linux.org.uk> (raw)

i2c_use_client() contains a bogosity.  If i2c_inc_use_client() returns
success, i2c_use_client() returns an error.  If i2c_inc_use_client()
fails, i2c_use_client() might succeed.

Fix it so that (a) we get the correct sense between these two functions,
and (b) propagate the error code from i2c_inc_use_client(), rather than
making our own one up.

--- orig/drivers/i2c/i2c-core.c	Wed Feb 18 22:33:49 2004
+++ linux/drivers/i2c/i2c-core.c	Sun Mar  7 16:05:27 2004
@@ -437,8 +437,11 @@ static void i2c_dec_use_client(struct i2
 
 int i2c_use_client(struct i2c_client *client)
 {
-	if (!i2c_inc_use_client(client))
-		return -ENODEV;
+	int ret;
+
+	ret = i2c_inc_use_client(client);
+	if (ret)
+		return ret;
 
 	if (client->flags & I2C_CLIENT_ALLOW_USE) {
 		if (client->flags & I2C_CLIENT_ALLOW_MULTIPLE_USE)

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core

             reply	other threads:[~2004-03-07 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-07 16:13 Russell King [this message]
2004-03-09 23:02 ` 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=20040307161341.A7065@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®