linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
	dri-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org,
	Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>,
	Lucas Stach <l.stach@pengutronix.de>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Shawn Guo <shawnguo@kernel.org>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	linux-imx@nxp.com, Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Jyri Sarha <jyri.sarha@iki.fi>
Subject: Re: [PATCH 1/7] drm/omap: Cast pointer to integer safely
Date: Thu, 29 Jul 2021 09:13:17 +0300	[thread overview]
Message-ID: <69ac4474-3bbf-db72-3777-74c59f947d42@ideasonboard.com> (raw)
In-Reply-To: <20210728153736.15240-2-laurent.pinchart+renesas@ideasonboard.com>

On 28/07/2021 18:37, Laurent Pinchart wrote:
> On 64-bit platforms, the compiler complains that casting a void pointer
> to an unsigned int loses data. Cast the pointer to a uintptr_t unsigned
> to fix this.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
>   drivers/gpu/drm/omapdrm/omap_drv.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index f86e20578143..c05d3975cb31 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -572,7 +572,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>   	priv->dss->mgr_ops_priv = priv;
>   
>   	soc = soc_device_match(omapdrm_soc_devices);
> -	priv->omaprev = soc ? (unsigned int)soc->data : 0;
> +	priv->omaprev = soc ? (uintptr_t)soc->data : 0;
>   	priv->wq = alloc_ordered_workqueue("omapdrm", 0);
>   
>   	mutex_init(&priv->list_lock);
> 

Looks fine, although the subject sounds odd. Why was the cast "unsafe" before, and "safe" now?

There's also another bunch of warnings I see:

drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘dsi_vc_send_long’:
drivers/gpu/drm/omapdrm/dss/dsi.c:7:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘size_t’ {aka ‘const long unsigned int’} [-Wformat=]
     7 | #define DSS_SUBSYS_NAME "DSI"
       |                         ^~~~~
drivers/gpu/drm/omapdrm/dss/dss.h:30:21: note: in expansion of macro ‘DSS_SUBSYS_NAME’
    30 | #define pr_fmt(fmt) DSS_SUBSYS_NAME ": " fmt
       |                     ^~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:134:15: note: in expansion of macro ‘pr_fmt’
   134 |   func(&id, ##__VA_ARGS__);  \
       |               ^~~~~~~~~~~
./include/linux/dynamic_debug.h:152:2: note: in expansion of macro ‘__dynamic_func_call’
   152 |  __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__)
       |  ^~~~~~~~~~~~~~~~~~~
./include/linux/dynamic_debug.h:162:2: note: in expansion of macro ‘_dynamic_func_call’
   162 |  _dynamic_func_call(fmt, __dynamic_pr_debug,  \
       |  ^~~~~~~~~~~~~~~~~~
./include/linux/printk.h:471:2: note: in expansion of macro ‘dynamic_pr_debug’
   471 |  dynamic_pr_debug(fmt, ##__VA_ARGS__)
       |  ^~~~~~~~~~~~~~~~
drivers/gpu/drm/omapdrm/dss/dss.h:36:2: note: in expansion of macro ‘pr_debug’
    36 |  pr_debug(format, ## __VA_ARGS__)
       |  ^~~~~~~~
drivers/gpu/drm/omapdrm/dss/dsi.c:2097:3: note: in expansion of macro ‘DSSDBG’
  2097 |   DSSDBG("dsi_vc_send_long, %d bytes\n", msg->tx_len);
       |   ^~~~~~
In file included from ./include/linux/printk.h:7,
                  from ./include/linux/kernel.h:19,
                  from drivers/gpu/drm/omapdrm/dss/dsi.c:9:
drivers/gpu/drm/omapdrm/dss/dsi.c: In function ‘dsi_vc_generic_read’:
./include/linux/kern_levels.h:5:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘size_t’ {aka ‘const long unsigned int’} [-Wformat=]
     5 | #define KERN_SOH "\001"  /* ASCII Start Of Header */
       |                  ^~~~~~
./include/linux/kern_levels.h:11:18: note: in expansion of macro ‘KERN_SOH’
    11 | #define KERN_ERR KERN_SOH "3" /* error conditions */
       |                  ^~~~~~~~
./include/linux/printk.h:390:9: note: in expansion of macro ‘KERN_ERR’
   390 |  printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__)
       |         ^~~~~~~~
drivers/gpu/drm/omapdrm/dss/dss.h:40:2: note: in expansion of macro ‘pr_err’
    40 |  pr_err("omapdss " DSS_SUBSYS_NAME " error: " format, ##__VA_ARGS__)
       |  ^~~~~~
drivers/gpu/drm/omapdrm/dss/dsi.c:2393:2: note: in expansion of macro ‘DSSERR’
  2393 |  DSSERR("%s(vc %d, reqlen %d) failed\n", __func__,  vc, msg->tx_len);
       |  ^~~~~~


  Tomi

  reply	other threads:[~2021-07-29  6:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28 15:37 [PATCH 0/7] drm: Extend COMPILE_TEST support to some ARM drivers Laurent Pinchart
2021-07-28 15:37 ` [PATCH 1/7] drm/omap: Cast pointer to integer safely Laurent Pinchart
2021-07-29  6:13   ` Tomi Valkeinen [this message]
2021-07-31  0:25     ` Laurent Pinchart
2021-07-28 15:37 ` [PATCH 2/7] drm/sti: Use correct printk format specifiers for size_t Laurent Pinchart
2021-07-30  9:35   ` Philippe CORNU
2021-07-28 15:37 ` [PATCH 3/7] drm/imx/dcss: Enable COMPILE_TEST on all ARM64 platforms Laurent Pinchart
2021-07-30 12:10   ` Geert Uytterhoeven
2021-07-30 12:31     ` Philipp Zabel
2021-07-28 15:37 ` [PATCH 4/7] drm/omap: Enable COMPILE_TEST on all ARM and " Laurent Pinchart
2021-07-28 15:37 ` [PATCH 5/7] drm/sti: " Laurent Pinchart
2021-07-30  9:39   ` Philippe CORNU
2021-07-28 15:37 ` [PATCH 6/7] drm/tegra: Enable COMPILE_TEST on all " Laurent Pinchart
2021-07-28 15:37 ` [PATCH 7/7] drm/tilcdc: " Laurent Pinchart
2021-07-29  6:19 ` [PATCH 0/7] drm: Extend COMPILE_TEST support to some ARM drivers Tomi Valkeinen
     [not found] ` <YQLdDTu4duXXQXAs@ravnborg.org>
2021-07-30 19:33   ` Laurent Pinchart

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=69ac4474-3bbf-db72-3777-74c59f947d42@ideasonboard.com \
    --to=tomi.valkeinen@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=festevam@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=jyri.sarha@iki.fi \
    --cc=l.stach@pengutronix.de \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=laurentiu.palcu@oss.nxp.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=thierry.reding@gmail.com \
    --subject='Re: [PATCH 1/7] drm/omap: Cast pointer to integer safely' \
    /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

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).