All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Rosin <peda@axentia.se>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Linux I2C <linux-i2c@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH 1/2] i2c: gpio: fault-injector: add 'lose_arbitration' injector
Date: Tue, 19 Feb 2019 14:07:34 +0000	[thread overview]
Message-ID: <31a56125-8aa3-9ed1-3a68-3ae766c41cd9@axentia.se> (raw)
In-Reply-To: <20190219131338.buwlfcxdutckpqqc@ninjato>

On 2019-02-19 14:13, Wolfram Sang wrote:
> 
>>>>> +       ret = gpiod_direction_output(priv->scl, 1);
>>>>
>>>> This may overwrite the error code returned by request_irq().
>>>
>>> Yeah. What do you think about this, is this too dense?
>>>
>>> 	ret = gpiod_direction_output(priv->scl, 1) ?: ret;
>>
>> That may also overwrite the error code, of course. Isn't it
>> usually best to return the first error? I have no clue if that
>> guideline does not apply here, though...
> 
> I am neither entirely sure here. My take was that the above was the more
> severe error. Because if setting to output fails, the GPIO I2C bus will
> be broken. If the former stuff fails, well, the injection didn't work or
> was interrupted.
> 
> However, the GPIO was set to output before the injector. So, if setting
> it back fails, then the system likely has more severe problems anyhow?

One way to end up with that is if there is an irq attached to the gpio
pin. If you disable the irq, you are (sometimes) allowed to change the
gpio to output, but not if the irq is active. So, if some other part of
the driver "steals" the gpio by activating an irq while the injector is
doing its thing, it is possible to end up with this.

But that seems like a gigantic corner case.

> I am open to any better solution. However, let's not forget, this is
> debug code aimed to be used by devs.
> 

You are right, please ignore me.

Cheers,
Peter

  reply	other threads:[~2019-02-19 14:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-17 12:41 [PATCH 0/2] i2c: gpio: fault-injector: add two new injectors Wolfram Sang
2019-02-17 12:41 ` [PATCH 1/2] i2c: gpio: fault-injector: add 'lose_arbitration' injector Wolfram Sang
2019-02-18  9:17   ` Geert Uytterhoeven
2019-02-18 20:41     ` Wolfram Sang
2019-02-18 23:48       ` Peter Rosin
2019-02-19 13:13         ` Wolfram Sang
2019-02-19 14:07           ` Peter Rosin [this message]
2019-02-19  7:53       ` Geert Uytterhoeven
2019-02-19 13:18         ` Wolfram Sang
2019-02-19 13:33           ` Geert Uytterhoeven
2019-02-19 13:37             ` Wolfram Sang
2019-02-19 16:26           ` Wolfram Sang
2019-02-17 12:41 ` [PATCH 2/2] i2c: gpio: fault-injector: add 'inject_panic' injector Wolfram Sang

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=31a56125-8aa3-9ed1-3a68-3ae766c41cd9@axentia.se \
    --to=peda@axentia.se \
    --cc=geert@linux-m68k.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@the-dreams.de \
    /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.