From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Bartosz Golaszewski <brgl@bgdev.pl> Cc: Jonathan Cameron <jic23@kernel.org>, Hartmut Knaack <knaack.h@gmx.de>, Lars-Peter Clausen <lars@metafoo.de>, Peter Meerwald-Stadler <pmeerw@pmeerw.net>, Michal Simek <michal.simek@xilinx.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Guenter Roeck <linux@roeck-us.net>, linux-iio <linux-iio@vger.kernel.org>, Linux ARM <linux-arm-kernel@lists.infradead.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Bartosz Golaszewski <bgolaszewski@baylibre.com> Subject: Re: [PATCH v7 1/3] devres: provide devm_krealloc() Date: Wed, 19 Aug 2020 12:14:16 +0300 [thread overview] Message-ID: <20200819091416.GX1891694@smile.fi.intel.com> (raw) In-Reply-To: <CAMRc=MfmmRweZ_WBkqA_FHVoTZ5KxNwyFLjwpypG5c=K9ki8XA@mail.gmail.com> On Tue, Aug 18, 2020 at 08:13:10PM +0200, Bartosz Golaszewski wrote: > On Tue, Aug 18, 2020 at 7:19 PM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > On Tue, Aug 18, 2020 at 06:27:12PM +0200, Bartosz Golaszewski wrote: > > > On Tue, Aug 18, 2020 at 10:40 AM Andy Shevchenko > > > <andriy.shevchenko@linux.intel.com> wrote: > > > > On Mon, Aug 17, 2020 at 10:02:05PM +0200, Bartosz Golaszewski wrote: > > > > > On Mon, Aug 17, 2020 at 7:43 PM Andy Shevchenko > > > > > <andriy.shevchenko@linux.intel.com> wrote: > > > > > > On Mon, Aug 17, 2020 at 07:05:33PM +0200, Bartosz Golaszewski wrote: > > > > > > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com> ... > > > > > > > +static struct devres *to_devres(void *data) > > > > > > > +{ > > > > > > > + return (struct devres *)((u8 *)data - ALIGN(sizeof(struct devres), > > > > > > > + ARCH_KMALLOC_MINALIGN)); > > > > > > > > > > > > Do you really need both explicit castings? > > > > > > > > > > > > > > > > Yeah, we can probably drop the (struct devres *) here. > > > > > > > > void * -> u8 * here is also not needed, it is considered byte access IIRC. > > > > > > > > > > Actually it turns out that while we don't need the (void *) -> (u8 *) > > > casting, we must cast to (struct devres *) or the following error is > > > produced: > > > > > > drivers/base/devres.c: In function ‘to_devres’: > > > drivers/base/devres.c:41:21: error: returning ‘u8 *’ {aka ‘unsigned > > > char *’} from a function with incompatible return type ‘struct devres > > > *’ [-Werror=incompatible-pointer-types] > > > return ((u8 *)data - ALIGN(sizeof(struct devres), > > > ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ARCH_KMALLOC_MINALIGN)); > > > ~~~~~~~~~~~~~~~~~~~~~~~ > > > > Of course, you have to drop u8 * casting as well. > > > > Yes, of course. Duh With this addressed (and don't forget to remove also unneeded parentheses), Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Thanks! -- With Best Regards, Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Bartosz Golaszewski <brgl@bgdev.pl> Cc: Linux ARM <linux-arm-kernel@lists.infradead.org>, Lars-Peter Clausen <lars@metafoo.de>, linux-iio <linux-iio@vger.kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Michal Simek <michal.simek@xilinx.com>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>, Bartosz Golaszewski <bgolaszewski@baylibre.com>, Guenter Roeck <linux@roeck-us.net>, Peter Meerwald-Stadler <pmeerw@pmeerw.net>, Hartmut Knaack <knaack.h@gmx.de>, Jonathan Cameron <jic23@kernel.org> Subject: Re: [PATCH v7 1/3] devres: provide devm_krealloc() Date: Wed, 19 Aug 2020 12:14:16 +0300 [thread overview] Message-ID: <20200819091416.GX1891694@smile.fi.intel.com> (raw) In-Reply-To: <CAMRc=MfmmRweZ_WBkqA_FHVoTZ5KxNwyFLjwpypG5c=K9ki8XA@mail.gmail.com> On Tue, Aug 18, 2020 at 08:13:10PM +0200, Bartosz Golaszewski wrote: > On Tue, Aug 18, 2020 at 7:19 PM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > On Tue, Aug 18, 2020 at 06:27:12PM +0200, Bartosz Golaszewski wrote: > > > On Tue, Aug 18, 2020 at 10:40 AM Andy Shevchenko > > > <andriy.shevchenko@linux.intel.com> wrote: > > > > On Mon, Aug 17, 2020 at 10:02:05PM +0200, Bartosz Golaszewski wrote: > > > > > On Mon, Aug 17, 2020 at 7:43 PM Andy Shevchenko > > > > > <andriy.shevchenko@linux.intel.com> wrote: > > > > > > On Mon, Aug 17, 2020 at 07:05:33PM +0200, Bartosz Golaszewski wrote: > > > > > > > From: Bartosz Golaszewski <bgolaszewski@baylibre.com> ... > > > > > > > +static struct devres *to_devres(void *data) > > > > > > > +{ > > > > > > > + return (struct devres *)((u8 *)data - ALIGN(sizeof(struct devres), > > > > > > > + ARCH_KMALLOC_MINALIGN)); > > > > > > > > > > > > Do you really need both explicit castings? > > > > > > > > > > > > > > > > Yeah, we can probably drop the (struct devres *) here. > > > > > > > > void * -> u8 * here is also not needed, it is considered byte access IIRC. > > > > > > > > > > Actually it turns out that while we don't need the (void *) -> (u8 *) > > > casting, we must cast to (struct devres *) or the following error is > > > produced: > > > > > > drivers/base/devres.c: In function ‘to_devres’: > > > drivers/base/devres.c:41:21: error: returning ‘u8 *’ {aka ‘unsigned > > > char *’} from a function with incompatible return type ‘struct devres > > > *’ [-Werror=incompatible-pointer-types] > > > return ((u8 *)data - ALIGN(sizeof(struct devres), > > > ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > ARCH_KMALLOC_MINALIGN)); > > > ~~~~~~~~~~~~~~~~~~~~~~~ > > > > Of course, you have to drop u8 * casting as well. > > > > Yes, of course. Duh With this addressed (and don't forget to remove also unneeded parentheses), Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Thanks! -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-08-19 9:31 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-17 17:05 [PATCH v7 0/3] devres: provide and use devm_krealloc() Bartosz Golaszewski 2020-08-17 17:05 ` Bartosz Golaszewski 2020-08-17 17:05 ` [PATCH v7 1/3] devres: provide devm_krealloc() Bartosz Golaszewski 2020-08-17 17:05 ` Bartosz Golaszewski 2020-08-17 17:39 ` Andy Shevchenko 2020-08-17 17:39 ` Andy Shevchenko 2020-08-17 20:02 ` Bartosz Golaszewski 2020-08-17 20:02 ` Bartosz Golaszewski 2020-08-18 8:25 ` Andy Shevchenko 2020-08-18 8:25 ` Andy Shevchenko 2020-08-18 16:27 ` Bartosz Golaszewski 2020-08-18 16:27 ` Bartosz Golaszewski 2020-08-18 17:10 ` Andy Shevchenko 2020-08-18 17:10 ` Andy Shevchenko 2020-08-18 18:13 ` Bartosz Golaszewski 2020-08-18 18:13 ` Bartosz Golaszewski 2020-08-19 9:14 ` Andy Shevchenko [this message] 2020-08-19 9:14 ` Andy Shevchenko 2020-08-17 17:05 ` [PATCH v7 2/3] hwmon: pmbus: use more devres helpers Bartosz Golaszewski 2020-08-17 17:05 ` Bartosz Golaszewski 2020-08-17 17:05 ` [PATCH v7 3/3] iio: adc: xilinx-xadc: use devm_krealloc() Bartosz Golaszewski 2020-08-17 17:05 ` Bartosz Golaszewski
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=20200819091416.GX1891694@smile.fi.intel.com \ --to=andriy.shevchenko@linux.intel.com \ --cc=bgolaszewski@baylibre.com \ --cc=brgl@bgdev.pl \ --cc=gregkh@linuxfoundation.org \ --cc=jic23@kernel.org \ --cc=knaack.h@gmx.de \ --cc=lars@metafoo.de \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-iio@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@roeck-us.net \ --cc=michal.simek@xilinx.com \ --cc=pmeerw@pmeerw.net \ /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: linkBe 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.