Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45777c49 authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho
Browse files

wl18xx: alloc conf.phy memory to ensure alignemnt



We get DMA alignment trouble if the beginning of the conf.phy struct is
not aligned to 4 bytes. Use kmemdup to ensure alignment.

Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 097b0e1b
Loading
Loading
Loading
Loading
+10 −2
Original line number Original line Diff line number Diff line
@@ -772,16 +772,24 @@ static int wl18xx_pre_upload(struct wl1271 *wl)
static int wl18xx_set_mac_and_phy(struct wl1271 *wl)
static int wl18xx_set_mac_and_phy(struct wl1271 *wl)
{
{
	struct wl18xx_priv *priv = wl->priv;
	struct wl18xx_priv *priv = wl->priv;
	struct wl18xx_mac_and_phy_params *params;
	int ret;
	int ret;


	params = kmemdup(&priv->conf.phy, sizeof(*params), GFP_KERNEL);
	if (!params) {
		ret = -ENOMEM;
		goto out;
	}

	ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]);
	ret = wlcore_set_partition(wl, &wl->ptable[PART_PHY_INIT]);
	if (ret < 0)
	if (ret < 0)
		goto out;
		goto out;


	ret = wlcore_write(wl, WL18XX_PHY_INIT_MEM_ADDR, (u8 *)&priv->conf.phy,
	ret = wlcore_write(wl, WL18XX_PHY_INIT_MEM_ADDR, params,
			   sizeof(struct wl18xx_mac_and_phy_params), false);
			   sizeof(*params), false);


out:
out:
	kfree(params);
	return ret;
	return ret;
}
}