From: "Wojciech Zabołotny" <wzab@ise.pw.edu.pl>
To: Linus Walleij <linus.walleij@linaro.org>,
wzabolot@elektron.elka.pw.edu.pl
Cc: Michal Simek <michal.simek@xilinx.com>,
Randy Dunlap <rdunlap@infradead.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Bug introduced in the of_get_named_gpiod_flags function.
Date: Mon, 15 Oct 2018 15:41:20 +0200 [thread overview]
Message-ID: <d8faabe9-1123-3d0e-6b7d-8335cd2b6a44@ise.pw.edu.pl> (raw)
In-Reply-To: <CACRpkdaeBMc-wqZxh0vVXRiRMvTHDFXxOk0aaxN=swcnLBhG5w@mail.gmail.com>
On 13.10.2018 18:23, Linus Walleij wrote:
> On Sat, Oct 13, 2018 at 5:53 PM wzabolot@elektron.elka.pw.edu.pl
> <wzabolot@elektron.elka.pw.edu.pl> wrote:
>
>> The question is, if there may be any other in-tree GPIO controller
>> driver that does not initialize those flags?
> So as I said, I looked over them and they all initialize
> their flags.
>
>> Anyway the current situation is somehow dangerous.
> Not very dangerous compared to much other kernel code.
>
>> Maybe the best solution would be to initialize the automatic variable in
>> the of_find_gpio?
> Patches welcom, make sure they are tested with mainline
> code and drivers.
>
> Yours.
> Linus Walleij
OK. So I suggested correction of the Xilinx GPIO driver so that it always sets the flags:
static int xgpio_xlate(struct gpio_chip *gc,
const struct of_phandle_args *gpiospec, u32 *flags)
{
struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
struct xgpio_instance *chip = container_of(mm_gc, struct xgpio_instance,
mmchip);
if(flags)
* flags = 0;
if (gpiospec->args[1] == chip->offset)
return gpiospec->args[0];
return -EINVAL;
}
With best regards,
Wojtek
next prev parent reply other threads:[~2018-10-15 14:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-10 16:13 wzab
2018-10-10 16:39 ` Randy Dunlap
2018-10-11 8:27 ` Linus Walleij
2018-10-12 8:54 ` Michal Simek
2018-10-13 15:53 ` wzabolot
2018-10-13 16:23 ` Linus Walleij
2018-10-15 13:41 ` Wojciech Zabołotny [this message]
2018-10-10 16:30 Wojciech Zabołotny
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=d8faabe9-1123-3d0e-6b7d-8335cd2b6a44@ise.pw.edu.pl \
--to=wzab@ise.pw.edu.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=rdunlap@infradead.org \
--cc=wzabolot@elektron.elka.pw.edu.pl \
--cc=yamada.masahiro@socionext.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
all inboxes | Powered by JetHome®