usb: renesas_usbhs: Use struct assignment instead of memcpy()
To avoid the error-proneness of calls to sizeof() in the memcpy, this patch uses struct assignment instead of memcpy. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>--- This patch is based on Greg's linux-usb.git / usb-next branch. Note that mod_host.c also has memcpy but we cannot use struct assignment for it because the type of urb->setup_patcket is just "unsigned char *". drivers/usb/renesas_usbhs/common.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>alistair/sunxi64-5.4-dsi
parent
d46a6024c7
commit
743344a952
|
@ -651,9 +651,8 @@ static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dparam = &info->driver_param;
|
dparam = &info->driver_param;
|
||||||
memcpy(dparam, &data->param, sizeof(data->param));
|
*dparam = data->param;
|
||||||
memcpy(&info->platform_callback, data->platform_callback,
|
info->platform_callback = *data->platform_callback;
|
||||||
sizeof(*data->platform_callback));
|
|
||||||
|
|
||||||
if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp))
|
if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp))
|
||||||
dparam->buswait_bwait = tmp;
|
dparam->buswait_bwait = tmp;
|
||||||
|
@ -714,17 +713,13 @@ static int usbhs_probe(struct platform_device *pdev)
|
||||||
* care platform info
|
* care platform info
|
||||||
*/
|
*/
|
||||||
|
|
||||||
memcpy(&priv->dparam,
|
priv->dparam = info->driver_param;
|
||||||
&info->driver_param,
|
|
||||||
sizeof(struct renesas_usbhs_driver_param));
|
|
||||||
|
|
||||||
if (!info->platform_callback.get_id) {
|
if (!info->platform_callback.get_id) {
|
||||||
dev_err(&pdev->dev, "no platform callbacks");
|
dev_err(&pdev->dev, "no platform callbacks");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
memcpy(&priv->pfunc,
|
priv->pfunc = info->platform_callback;
|
||||||
&info->platform_callback,
|
|
||||||
sizeof(struct renesas_usbhs_platform_callback));
|
|
||||||
|
|
||||||
/* set driver callback functions for platform */
|
/* set driver callback functions for platform */
|
||||||
dfunc = &info->driver_callback;
|
dfunc = &info->driver_callback;
|
||||||
|
|
Loading…
Reference in New Issue