[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230818173902.GE986605@google.com>
Date: Fri, 18 Aug 2023 18:39:02 +0100
From: Lee Jones <lee@...nel.org>
To: Nathan Chancellor <nathan@...nel.org>
Cc: Justin Stitt <justinstitt@...gle.com>, Pavel Machek <pavel@....cz>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, linux-leds@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] leds: pca955x: fix -Wvoid-pointer-to-enum-cast warning
On Fri, 18 Aug 2023, Nathan Chancellor wrote:
> On Fri, Aug 18, 2023 at 05:01:54PM +0100, Lee Jones wrote:
> > On Wed, 16 Aug 2023, Justin Stitt wrote:
> >
> > > When building with clang 18 I see the following warning:
> > > | drivers/leds/leds-pca955x.c:487:15: warning: cast to smaller integer
> > > | type 'enum pca955x_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
> > > | 487 | chip_type = (enum pca955x_type)md;
> > >
> > > This is due to the fact that `md` is a void* while `enum pca995x_type` has the
> > > size of an int.
> > >
> > > Add uintptr_t cast to silence clang warning while also keeping enum cast
> > > for readability and consistency with other `chip_type` assignment just a
> > > few lines below:
> > > | chip_type = (enum pca955x_type)id->driver_data;
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/1910
> > > Reported-by: Nathan Chancellor <nathan@...nel.org>
> >
> > A review from Nathan would be good here.
>
> Reviewed-by: Nathan Chancellor <nathan@...nel.org>
Thank you.
--
Lee Jones [李琼斯]
Powered by blists - more mailing lists