drm: omapdrm: Use sizeof(*var) instead of sizeof(type) for structures
By linking the sizeof to a variable type the code will be less prone to bugs due to future type changes of variables. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
parent
84e1d4578f
commit
d501b12999
|
@ -1253,7 +1253,7 @@ static int dsicm_probe(struct platform_device *pdev)
|
|||
dsicm_hw_reset(ddata);
|
||||
|
||||
if (ddata->use_dsi_backlight) {
|
||||
memset(&props, 0, sizeof(struct backlight_properties));
|
||||
memset(&props, 0, sizeof(props));
|
||||
props.max_brightness = 255;
|
||||
|
||||
props.type = BACKLIGHT_RAW;
|
||||
|
|
|
@ -119,8 +119,7 @@ static void __init omapdss_omapify_node(struct device_node *node)
|
|||
|
||||
static void __init omapdss_add_to_list(struct device_node *node, bool root)
|
||||
{
|
||||
struct dss_conv_node *n = kmalloc(sizeof(struct dss_conv_node),
|
||||
GFP_KERNEL);
|
||||
struct dss_conv_node *n = kmalloc(sizeof(*n), GFP_KERNEL);
|
||||
if (n) {
|
||||
n->node = node;
|
||||
n->root = root;
|
||||
|
|
|
@ -162,7 +162,7 @@ static int omap_connector_mode_valid(struct drm_connector *connector,
|
|||
|
||||
dssdrv->get_timings(dssdev, &t);
|
||||
|
||||
if (memcmp(&vm, &t, sizeof(struct videomode)))
|
||||
if (memcmp(&vm, &t, sizeof(vm)))
|
||||
r = -EINVAL;
|
||||
else
|
||||
r = 0;
|
||||
|
@ -217,7 +217,7 @@ struct drm_connector *omap_connector_init(struct drm_device *dev,
|
|||
|
||||
omap_dss_get_device(dssdev);
|
||||
|
||||
omap_connector = kzalloc(sizeof(struct omap_connector), GFP_KERNEL);
|
||||
omap_connector = kzalloc(sizeof(*omap_connector), GFP_KERNEL);
|
||||
if (!omap_connector)
|
||||
goto fail;
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ static void dmm_txn_append(struct dmm_txn *txn, struct pat_area *area,
|
|||
int rows = (1 + area->y1 - area->y0);
|
||||
int i = columns*rows;
|
||||
|
||||
pat = alloc_dma(txn, sizeof(struct pat), &pat_pa);
|
||||
pat = alloc_dma(txn, sizeof(*pat), &pat_pa);
|
||||
|
||||
if (txn->last_pat)
|
||||
txn->last_pat->next_pa = (uint32_t)pat_pa;
|
||||
|
@ -735,7 +735,7 @@ static int omap_dmm_probe(struct platform_device *dev)
|
|||
|
||||
/* alloc engines */
|
||||
omap_dmm->engines = kcalloc(omap_dmm->num_engines,
|
||||
sizeof(struct refill_engine), GFP_KERNEL);
|
||||
sizeof(*omap_dmm->engines), GFP_KERNEL);
|
||||
if (!omap_dmm->engines) {
|
||||
ret = -ENOMEM;
|
||||
goto fail;
|
||||
|
|
|
@ -117,7 +117,7 @@ static int omap_encoder_update(struct drm_encoder *encoder,
|
|||
|
||||
dssdrv->get_timings(dssdev, &t);
|
||||
|
||||
if (memcmp(vm, &t, sizeof(struct videomode)))
|
||||
if (memcmp(vm, &t, sizeof(*vm)))
|
||||
ret = -EINVAL;
|
||||
else
|
||||
ret = 0;
|
||||
|
|
Loading…
Reference in New Issue