linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Justin Stitt <justinstitt@google.com>,
	Pavel Machek <pavel@ucw.cz>,
	Nick Desaulniers <ndesaulniers@google.com>,
	Tom Rix <trix@redhat.com>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH] leds: pca955x: fix -Wvoid-pointer-to-enum-cast warning
Date: Fri, 18 Aug 2023 18:39:02 +0100	[thread overview]
Message-ID: <20230818173902.GE986605@google.com> (raw)
In-Reply-To: <20230818160648.GA939927@dev-arch.thelio-3990X>

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@kernel.org>
> > 
> > A review from Nathan would be good here.
> 
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>

Thank you.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2023-08-18 17:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16 19:37 [PATCH] leds: pca955x: fix -Wvoid-pointer-to-enum-cast warning Justin Stitt
2023-08-18 16:01 ` Lee Jones
2023-08-18 16:06   ` Nathan Chancellor
2023-08-18 17:39     ` Lee Jones [this message]
2023-09-19 14:55 ` (subset) " Lee Jones

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=20230818173902.GE986605@google.com \
    --to=lee@kernel.org \
    --cc=justinstitt@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=pavel@ucw.cz \
    --cc=trix@redhat.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;
as well as URLs for NNTP newsgroup(s).