Message ID | 20240213095719.454865-1-arnd@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-63285-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp432660dyb; Tue, 13 Feb 2024 01:59:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU1pkx4/G/gXxuJ2F1ccRgfJrWCeOzI0jSoekTnlqDe2rpt0/nu6y//OVcw9Cm8NmaAMeNPSvW2NcT9J0MgJHGvj2kpwg== X-Google-Smtp-Source: AGHT+IERmPZ4TW52YxFyK3oJyasQUIiw4sltk9qbM9cAKh78a8PlUpwLFAQtuVfdd2rrvCf9VHhc X-Received: by 2002:a05:622a:211:b0:42c:7c0e:1dda with SMTP id b17-20020a05622a021100b0042c7c0e1ddamr5993473qtx.6.1707818361586; Tue, 13 Feb 2024 01:59:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707818361; cv=pass; d=google.com; s=arc-20160816; b=UVEjknR0pcF7a2K8gH0TtzKVJNTbawHylkrFGnludGPYoATxBuxFG2dn+j+Wgcwvor jzBub//UUr85qifK2UgcbdxlUusP4w8Nl4pTOnH4NSv34aexO4ezs4Rb+b6Nvo2jnNHq 8z4oHvFzUE2pD7i80UGjKMdHPjm+1eid6gy91MDMYebJOy3a5/rfsp2x1a4DQVRCPwJH q3IPEIg0FoZyz07Zc70X9fqt24W/TyJOrQTWhU91wFUbPL07rLutS30BBfeE9DP1wori HF2qiET1s0YmNUA4YZmOZQDzzpfT+VVQzHmPKPa49AFN9PJnzn0yLZFxVYYuJ1rHj88G A9BQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=xE3noUtwiUycfA40h1ozVVtCl9gA/4gLOk194AkPOOA=; fh=I2GrElZsLz3HejIPyt2SVhxzuBFya8Y4m/jnvK2Ovr0=; b=I3nEuvTx8TOwmWVtaRZutKI1OKabhnQJ7dWR0vMOGFQmxQd91gOIn/+OpzUCDw1woQ QT9jLA1lnsiei6TAC7VFXkEJl3pvslVb3ibUzNNgZn0IftyOjShnwQHSwJTp37KhRhz7 12+cDZMVso5sUabsQzZdGU9V50HSybLIrvQJ7atGCitpSlTNo6WsIDsyoPVfq29jiHyq pStV8JTaQtX+ydap+iwx+BtIKCi1i592T3EmdRyj62kUAVBuvhanYUJ3scA/K/WWqp00 OZuZzPlHOiyT5Cykp7zId5cIHeVb6jIv7OSd+wWn9+qnV051jJmqDPw+Wnok/3avJDgi /4sw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HLGi7my8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63285-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63285-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUSc14ARYCgwHxHmSqKThBG3YJ19Snk3Lhsb9+SfGahS0nHOM+WTfQ61QfKhICIfFO6y/Fq9psElgzMG5cmGqhzmHTmbA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o15-20020a05622a138f00b0042c2812fa40si2594016qtk.757.2024.02.13.01.59.21 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Feb 2024 01:59:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-63285-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HLGi7my8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-63285-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-63285-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 60F351C20C00 for <ouuuleilei@gmail.com>; Tue, 13 Feb 2024 09:59:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BDC23D3A4; Tue, 13 Feb 2024 09:57:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HLGi7my8" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEE2439FCD; Tue, 13 Feb 2024 09:57:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818246; cv=none; b=QFvBACG0ytqkLr3Bn/1HMHbW/wvJy5Nd0o2rLAwOKstFEaurMZMUUroWVMtPfPqU2QJqfyON+Cmf0qHr1ONX0DFskEQpFMZOBZ4lJPQV7SFnsLiEFTRzfHOcv30Lfhv97p2AalAK/Pasodlpo5yLf0MeIy5z3ZAtLXltpmg1seI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707818246; c=relaxed/simple; bh=kvqVpaVk50IzPZXU0zbw6srWa1WNF8IF4uR3vDkrvns=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=UEHulaq3ELRNpN+k7Lb8i3jcY/favOL9J7NQbw1OS1ZTJ/c/ckE9hzmjcmlzPZz60rWXJVkOUYL6YIjb+uQMvgQXQnKgynBWL581w+RxHPenUDkRwnZCg0oAMPHTXaWHAh+7u7c6fDLxqMz+Wb2xpcEZei4U+ncFzV8yckNTORk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HLGi7my8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D55E0C433F1; Tue, 13 Feb 2024 09:57:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707818246; bh=kvqVpaVk50IzPZXU0zbw6srWa1WNF8IF4uR3vDkrvns=; h=From:To:Cc:Subject:Date:From; b=HLGi7my8bug6KjC9594j1s1zjeyGPS67H4uIlBCSZTwYYt3hKHFOep4cu2crIbocS 8ZDjbcKKRvREI+oWMYpbd1R092rAAR2t7MuXElt/XsMzg4YKA1bFykJ3vvtZvixfav B4aJ7bTn9pp6AOe5GiZxTQxjkCgLEulvISVc+0KAnMzVLOtrDw9ajDmptCpR1W6mhb 6yjEoJqSQqeuK62ts3lf8wIxGoPNDYTYcEozb6i8+2nMyBDcIxqkqtURhUdtWOBuR7 0OkXKuzvXnmbofOY7tQoAe57fFV4+WU3C1vzBgFIG8asp/w9Sx8BabAPFGgar5KoWU Mw0bqGOnWx4sw== From: Arnd Bergmann <arnd@kernel.org> To: Lucas De Marchi <lucas.demarchi@intel.com>, Oded Gabbay <ogabbay@kernel.org>, =?utf-8?q?Thomas_Hellstr=C3=B6m?= <thomas.hellstrom@linux.intel.com> Cc: Arnd Bergmann <arnd@arndb.de>, Maarten Lankhorst <maarten.lankhorst@linux.intel.com>, Maxime Ripard <mripard@kernel.org>, Thomas Zimmermann <tzimmermann@suse.de>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Nathan Chancellor <nathan@kernel.org>, Nick Desaulniers <ndesaulniers@google.com>, Bill Wendling <morbo@google.com>, Justin Stitt <justinstitt@google.com>, intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] drm/xe: avoid function cast warnings Date: Tue, 13 Feb 2024 10:56:48 +0100 Message-Id: <20240213095719.454865-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790777346577648497 X-GMAIL-MSGID: 1790777346577648497 |
Series |
drm/xe: avoid function cast warnings
|
|
Commit Message
Arnd Bergmann
Feb. 13, 2024, 9:56 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de> clang-16 warns about a cast between incompatible function types: drivers/gpu/drm/xe/xe_range_fence.c:155:10: error: cast from 'void (*)(const void *)' to 'void (*)(struct xe_range_fence *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict] 155 | .free = (void (*)(struct xe_range_fence *rfence)) kfree, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Avoid this with a trivial helper function that calls kfree() here. Fixes: 845f64bdbfc9 ("drm/xe: Introduce a range-fence utility") Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/gpu/drm/xe/xe_range_fence.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
Comments
On Tue, 2024-02-13 at 10:56 +0100, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > clang-16 warns about a cast between incompatible function types: > > drivers/gpu/drm/xe/xe_range_fence.c:155:10: error: cast from 'void > (*)(const void *)' to 'void (*)(struct xe_range_fence *)' converts to > incompatible function type [-Werror,-Wcast-function-type-strict] > 155 | .free = (void (*)(struct xe_range_fence *rfence)) > kfree, > | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Avoid this with a trivial helper function that calls kfree() here. > > Fixes: 845f64bdbfc9 ("drm/xe: Introduce a range-fence utility") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> Thanks, will push as soon as it passes CI. Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> > --- > drivers/gpu/drm/xe/xe_range_fence.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/xe/xe_range_fence.c > b/drivers/gpu/drm/xe/xe_range_fence.c > index d35d9ec58e86..8510be4466eb 100644 > --- a/drivers/gpu/drm/xe/xe_range_fence.c > +++ b/drivers/gpu/drm/xe/xe_range_fence.c > @@ -151,6 +151,11 @@ xe_range_fence_tree_next(struct xe_range_fence > *rfence, u64 start, u64 last) > return xe_range_fence_tree_iter_next(rfence, start, last); > } > > +static void xe_range_fence_free(struct xe_range_fence * rfence) > +{ > + kfree(rfence); > +} > + > const struct xe_range_fence_ops xe_range_fence_kfree_ops = { > - .free = (void (*)(struct xe_range_fence *rfence)) kfree, > + .free = xe_range_fence_free, > };
Hi, On Tue, 2024-02-13 at 10:56 +0100, Arnd Bergmann wrote: > From: Arnd Bergmann <arnd@arndb.de> > > clang-16 warns about a cast between incompatible function types: > > drivers/gpu/drm/xe/xe_range_fence.c:155:10: error: cast from 'void > (*)(const void *)' to 'void (*)(struct xe_range_fence *)' converts to > incompatible function type [-Werror,-Wcast-function-type-strict] > 155 | .free = (void (*)(struct xe_range_fence *rfence)) > kfree, > | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Avoid this with a trivial helper function that calls kfree() here. > > Fixes: 845f64bdbfc9 ("drm/xe: Introduce a range-fence utility") > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > --- > drivers/gpu/drm/xe/xe_range_fence.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/xe/xe_range_fence.c > b/drivers/gpu/drm/xe/xe_range_fence.c > index d35d9ec58e86..8510be4466eb 100644 > --- a/drivers/gpu/drm/xe/xe_range_fence.c > +++ b/drivers/gpu/drm/xe/xe_range_fence.c > @@ -151,6 +151,11 @@ xe_range_fence_tree_next(struct xe_range_fence > *rfence, u64 start, u64 last) > return xe_range_fence_tree_iter_next(rfence, start, last); > } > > +static void xe_range_fence_free(struct xe_range_fence * rfence) There's a checkpatch.pl style error above: s/* rfence/*rfence/. I can fix that up when pushing if it's ok with you. /Thomas > +{ > + kfree(rfence); > +} > + > const struct xe_range_fence_ops xe_range_fence_kfree_ops = { > - .free = (void (*)(struct xe_range_fence *rfence)) kfree, > + .free = xe_range_fence_free, > };
On Wed, Feb 14, 2024, at 11:10, Thomas Hellström wrote: > On Tue, 2024-02-13 at 10:56 +0100, Arnd Bergmann wrote: >> >> +static void xe_range_fence_free(struct xe_range_fence * rfence) > > There's a checkpatch.pl style error above: s/* rfence/*rfence/. I can > fix that up when pushing if it's ok with you. Right, I saw the report. Please fix it up then so I don't have to resubmit. Thanks, Arnd
diff --git a/drivers/gpu/drm/xe/xe_range_fence.c b/drivers/gpu/drm/xe/xe_range_fence.c index d35d9ec58e86..8510be4466eb 100644 --- a/drivers/gpu/drm/xe/xe_range_fence.c +++ b/drivers/gpu/drm/xe/xe_range_fence.c @@ -151,6 +151,11 @@ xe_range_fence_tree_next(struct xe_range_fence *rfence, u64 start, u64 last) return xe_range_fence_tree_iter_next(rfence, start, last); } +static void xe_range_fence_free(struct xe_range_fence * rfence) +{ + kfree(rfence); +} + const struct xe_range_fence_ops xe_range_fence_kfree_ops = { - .free = (void (*)(struct xe_range_fence *rfence)) kfree, + .free = xe_range_fence_free, };