From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> Date: Wed, 18 Jan 2017 22:23:18 +0100 A local variable was set to an error code in two cases before a concrete error situation was detected. Thus move the corresponding assignments into if branches to indicate a software failure there. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> --- arch/um/drivers/ubd_kern.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index 85410279beab..6d686f735538 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c @@ -1049,19 +1049,21 @@ static int ubd_remove(int n, char **error_out) { struct gendisk *disk = ubd_gendisk[n]; struct ubd *ubd_dev; - int err = -ENODEV; + int err; mutex_lock(&ubd_lock); ubd_dev = &ubd_devs[n]; - - if(ubd_dev->file == NULL) + if (!ubd_dev->file) { + err = -ENODEV; goto out; + } /* you cannot remove a open disk */ - err = -EBUSY; - if(ubd_dev->count > 0) + if (ubd_dev->count > 0) { + err = -EBUSY; goto out; + } ubd_gendisk[n] = NULL; if(disk != NULL){ -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html