summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-10-27 15:21:40 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2017-11-02 10:20:29 -0400
commit2d1d31dda766b146bbd77db5e4e1534f64c92c2b (patch)
tree288c8398041cf400cd06017b4312623a8f3926c1 /drivers/mmc
parent7f8e446b032bd6bbcec7c2f068d0a4f2d5929249 (diff)
mmc: vub300: Use common code in __download_offload_pseudocode()
Add a jump target so that a specific string copy operation is stored only once at the end of this function implementation. Replace two calls of the function "strncpy" by goto statements. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/vub300.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/mmc/host/vub300.c b/drivers/mmc/host/vub300.c
index e6091528aca3..1fe68137a30f 100644
--- a/drivers/mmc/host/vub300.c
+++ b/drivers/mmc/host/vub300.c
@@ -1246,12 +1246,8 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
1246 USB_RECIP_DEVICE, 0x0000, 0x0000, 1246 USB_RECIP_DEVICE, 0x0000, 0x0000,
1247 xfer_buffer, xfer_length, HZ); 1247 xfer_buffer, xfer_length, HZ);
1248 kfree(xfer_buffer); 1248 kfree(xfer_buffer);
1249 if (retval < 0) { 1249 if (retval < 0)
1250 strncpy(vub300->vub_name, 1250 goto copy_error_message;
1251 "SDIO pseudocode download failed",
1252 sizeof(vub300->vub_name));
1253 return;
1254 }
1255 } else { 1251 } else {
1256 dev_err(&vub300->udev->dev, 1252 dev_err(&vub300->udev->dev,
1257 "not enough memory for xfer buffer to send" 1253 "not enough memory for xfer buffer to send"
@@ -1293,12 +1289,8 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
1293 USB_RECIP_DEVICE, 0x0000, 0x0000, 1289 USB_RECIP_DEVICE, 0x0000, 0x0000,
1294 xfer_buffer, xfer_length, HZ); 1290 xfer_buffer, xfer_length, HZ);
1295 kfree(xfer_buffer); 1291 kfree(xfer_buffer);
1296 if (retval < 0) { 1292 if (retval < 0)
1297 strncpy(vub300->vub_name, 1293 goto copy_error_message;
1298 "SDIO pseudocode download failed",
1299 sizeof(vub300->vub_name));
1300 return;
1301 }
1302 } else { 1294 } else {
1303 dev_err(&vub300->udev->dev, 1295 dev_err(&vub300->udev->dev,
1304 "not enough memory for xfer buffer to send" 1296 "not enough memory for xfer buffer to send"
@@ -1351,6 +1343,12 @@ static void __download_offload_pseudocode(struct vub300_mmc_host *vub300,
1351 sizeof(vub300->vub_name)); 1343 sizeof(vub300->vub_name));
1352 return; 1344 return;
1353 } 1345 }
1346
1347 return;
1348
1349copy_error_message:
1350 strncpy(vub300->vub_name, "SDIO pseudocode download failed",
1351 sizeof(vub300->vub_name));
1354} 1352}
1355 1353
1356/* 1354/*