From: Sergio Paracuellos Date: Tue, 3 Apr 2018 15:13:00 +0000 (+0200) Subject: staging: ks7010: fix error handling in ks7010_upload_firmware X-Git-Tag: v4.19~841^2~764 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6e043704fb99e3e1d7a1bb02030e49c093cdd943;p=platform%2Fkernel%2Flinux-rpi.git staging: ks7010: fix error handling in ks7010_upload_firmware This commit checks missing error code check when checking if the firmware is running reading General Communication Register A (GCR_A). It also set ret to EBUSY if firmware is running before copying it. Signed-off-by: Sergio Paracuellos Reviewed-by: Dan Carpenter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c index 9907c0c..4d794ac 100644 --- a/drivers/staging/ks7010/ks7010_sdio.c +++ b/drivers/staging/ks7010/ks7010_sdio.c @@ -657,8 +657,11 @@ static int ks7010_upload_firmware(struct ks_sdio_card *card) /* Firmware running ? */ ret = ks7010_sdio_readb(priv, GCR_A, &byte); + if (ret) + goto release_host_and_free; if (byte == GCR_A_RUN) { netdev_dbg(priv->net_dev, "MAC firmware running ...\n"); + ret = -EBUSY; goto release_host_and_free; }