From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Hans de Goede <hdegoede@redhat.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Lars-Peter Clausen <lars@metafoo.de>,
Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH v1 1/4] iio: acpi: Fill data with NULL when iio_get_acpi_device_name_and_data() fails
Date: Fri, 1 Nov 2024 10:14:45 +0200 [thread overview]
Message-ID: <ZySN9b9PsRmNlvAu@smile.fi.intel.com> (raw)
In-Reply-To: <20241031191717.1a521f03@jic23-huawei>
On Thu, Oct 31, 2024 at 07:17:17PM +0000, Jonathan Cameron wrote:
> On Wed, 30 Oct 2024 18:02:17 +0200
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
>
> > Fill data with NULL, if provided, when returning NULL from
> > iio_get_acpi_device_name_and_data(). Note, the current users check
> > for name to be valid, except one case which was initially doing
> > like that and has to be fixed separately.
> >
> > Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > Closes: https://lore.kernel.org/r/54fac4a7-b601-40ce-8c00-d94807f5e214@stanley.mountain
> > Fixes: dc60de4eb0a4 ("iio: acpi: Add iio_get_acpi_device_name_and_data() helper function")
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> This is counter intuitive as usual expectation would be no side effects on an
> error return. How hard to fix all the users to initialize to NULL if they
> care about that?
v2 just has been sent, indeed the result looks much better, thanks for the review!
> There is still a chance we set it to NULL in here anyway, but that should only happen
> if we know the return is good in the sense of no error (missing ACPI etc)
> but not necessarily that dev_name() won't return NULL.
>
> Don't think dev_name() can currently return NULL but 'maybe' it could...
dev_name() can't return NULL on the properly initialised device (either with
device_add(), or via dev_set_name() call). I do not think we can ever get to
the ->probe() without the above. Tell me, if I'm wrong.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-11-01 8:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-30 16:02 [PATCH v1 0/4] iio: acpi: always initialise data in iio_get_acpi_device_name_and_data() Andy Shevchenko
2024-10-30 16:02 ` [PATCH v1 1/4] iio: acpi: Fill data with NULL when iio_get_acpi_device_name_and_data() fails Andy Shevchenko
2024-10-31 19:17 ` Jonathan Cameron
2024-11-01 8:14 ` Andy Shevchenko [this message]
2024-10-30 16:02 ` [PATCH v1 2/4] iio: accel: kxcjk-1013: Drop duplicate NULL check in kxcjk1013_probe() Andy Shevchenko
2024-10-30 16:02 ` [PATCH v1 3/4] iio: accel: kxcjk-1013: Deduplicate ODR startup time array Andy Shevchenko
2024-10-30 16:02 ` [PATCH v1 4/4] iio: light: isl29018: Check if name is valid in isl29018_probe() Andy Shevchenko
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=ZySN9b9PsRmNlvAu@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=dan.carpenter@linaro.org \
--cc=hdegoede@redhat.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--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