lkml.org 
[lkml]   [2020]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 09/15] media: sunxi: Add support for the A31 MIPI CSI-2 controller
On Fri, Dec 11, 2020 at 04:57:02PM +0100, Paul Kocialkowski wrote:
> +#define sun6i_mipi_csi2_subdev_video(subdev) \
> + container_of(subdev, struct sun6i_mipi_csi2_video, subdev)
> +
> +#define sun6i_mipi_csi2_video_dev(video) \
> + container_of(video, struct sun6i_mipi_csi2_dev, video)

Isn't it a bit unsafe?

The second subdev and video here is not the variable passed in the macro
but the field in the structure, so any attempt at using those two macros
with anything but a variable named subdev or video will result in a
compilation issue?

Maxime
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2020-12-14 12:42    [W:0.118 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site