From: Wei Chen Date: Wed, 18 Oct 2023 06:27:44 +0000 (+0800) Subject: misc: vexpress_config: Use member .priv_auto to set the private data X-Git-Url: http://git.dujemihanovic.xyz/img/static/gitweb.css?a=commitdiff_plain;h=ffdb85bfcfd79a432a9379a9a13680699eb686fb;p=u-boot.git misc: vexpress_config: Use member .priv_auto to set the private data In current vexpress_config_probe code, it sets the uclass private data directly. This will cause one compilation error: drivers/misc/vexpress_config.c:114:27: error: lvalue required as left operand of assignment 114 | dev_get_uclass_priv(dev) = priv; | ^ In this patch we set the uclass private data through struct member .priv_auto, and this compilation error disappears. Signed-off-by: Wei Chen Signed-off-by: Qi Feng Reviewed-by: Linus Walleij --- diff --git a/drivers/misc/vexpress_config.c b/drivers/misc/vexpress_config.c index 2baca48109..99aad1412a 100644 --- a/drivers/misc/vexpress_config.c +++ b/drivers/misc/vexpress_config.c @@ -92,7 +92,7 @@ static struct misc_ops vexpress_config_ops = { static int vexpress_config_probe(struct udevice *dev) { struct ofnode_phandle_args args; - struct vexpress_config_sysreg *priv; + struct vexpress_config_sysreg *priv = dev_get_priv(dev); const char *prop; int err, prop_size; @@ -105,11 +105,9 @@ static int vexpress_config_probe(struct udevice *dev) if (!prop || (strncmp(prop, "arm,vexpress-sysreg", 19) != 0)) return -ENOENT; - priv = calloc(1, sizeof(*priv)); if (!priv) return -ENOMEM; - dev_get_uclass_priv(dev) = priv; priv->addr = ofnode_get_addr(args.node); return dev_read_u32(dev, "arm,vexpress,site", &priv->site); @@ -127,4 +125,5 @@ U_BOOT_DRIVER(vexpress_config_drv) = { .bind = dm_scan_fdt_dev, .probe = vexpress_config_probe, .ops = &vexpress_config_ops, + .priv_auto = sizeof(struct vexpress_config_sysreg), };