Skip to contentSkip to conversation

drivers/ssb/sdio: Don't overwrite const buffer if block_write fails

PATCH In review Michael Büsch 2 participants 2 messages May 15, 2021 – Jun 15, 2021 Sonics silicon backplane driver (ssb)

lore
Share & tools
lore

Michael Büsch

author maintainer
#0 lore raw

PATCH 1/1 drivers/ssb/sdio: Don't overwrite const buffer if block_write fails

It doesn't make sense to clobber the const driver-side buffer, if a write-to-device attempt failed. All other SSB variants (PCI, PCMCIA and SoC) also don't corrupt the buffer on any failure in block_write. Therefore, remove this memset from the SDIO variant.

---

This memset has been introduced by the original patch that added SDIO support to SSB:
24ea602e183ca
Better late than never.

This change is only build tested, because I don't own the hardware. But to me this change looks reasonable.

drivers/ssb/sdio.c +0 -1
index 7fe0afb42234..66c5c2169704 100644
@@ -411,7 +411,6 @@ static void ssb_sdio_block_write(struct ssb_device *dev, const void *buffer,
 	sdio_claim_host(bus->host_sdio);
 	if (unlikely(ssb_sdio_switch_core(bus, dev))) {
 		error = -EIO;
-		memset((void *)buffer, 0xff, count);
 		goto err_out;
 	}
 	offset |= bus->sdio_sbaddr & 0xffff;
Signature · 1 line
Michael
#1 lore raw

Re: ssb: sdio: Don't overwrite const buffer if block_write fails

Quoted 7 lines · Michael Büsch

It doesn't make sense to clobber the const driver-side buffer, if a write-to-device attempt failed. All other SSB variants (PCI, PCMCIA and SoC) also don't corrupt the buffer on any failure in block_write. Therefore, remove this memset from the SDIO variant.

Patch applied to wireless-drivers-next.git, thanks.

47ec636f7a25 ssb: sdio: Don't overwrite const buffer if block_write fails

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/20210515210252.318be2ba@wiggum/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches