[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMRc=Md8zxoQB3gJ9qJ_EqgNn8JFhi5vkU=HBhAhM9KGxo2zSg@mail.gmail.com>
Date: Fri, 25 Oct 2024 18:12:36 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Kent Gibson <warthog618@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v2 1/5] gpio: sysfs: use cleanup guards for gpiod_data::mutex
On Fri, Oct 25, 2024 at 5:34 PM Kent Gibson <warthog618@...il.com> wrote:
>
> >
> > Yeah, I don't know why it was done. Typically you want to sanitize the
> > input before anything else and this is what's done almost everywhere
> > else. I'd keep it like that.
>
> Not knowing why it was done was precisely the reason I thought it
> should be left as is. The fact that the checks are performed in the
> other order elsewhere makes me think this one was done intentionally.
> Conceivably it could be used by userspace to test if a line is output when
> the direction is fixed (so /sys/class/gpio/gpioN/direction does not exist).
> So write a non-integer to the value and see if it returns -EPERM rather
> than -EINVAL.
>
> Admittedly I'm speculating, but I can't rule it out, so I wouldn't
> change the behaviour just because it is more aesthetically pleasing.
> And if you insist on tidying the behaviour then it should be in a separate
> patch rather than piggy-backing onto the guard change.
>
> Anyway, that is my 2c.
>
Ok, I'll restore the order in v3.
Bartosz
Powered by blists - more mailing lists