diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c
index d4a1a5ec0acc3b2e77d4f2f8727718e6d67d4042..c26f74128f2814e75e9032c89ffe569bb44eef8f 100644
--- a/lib/rsa/rsa-sign.c
+++ b/lib/rsa/rsa-sign.c
@@ -420,8 +420,10 @@ static int fdt_add_bignum(void *blob, int noffset, const char *prop_name,
 		BN_rshift(num, num, 32); /*  N = N/B */
 	}
 
-	/* We try signing with successively increasing size values, so this
-	 * might fail several times */
+	/*
+	 * We try signing with successively increasing size values, so this
+	 * might fail several times
+	 */
 	ret = fdt_setprop(blob, noffset, prop_name, buf, size);
 	if (ret)
 		return -FDT_ERR_NOSPACE;
diff --git a/tools/image-host.c b/tools/image-host.c
index 399ec94f8bfd846da392b96aa71a62588616a98a..11046952fcf0d4b65cdd85bd1362d5bc43c25c23 100644
--- a/tools/image-host.c
+++ b/tools/image-host.c
@@ -238,11 +238,16 @@ static int fit_image_process_sig(const char *keydir, void *keydest,
 	/* Get keyname again, as FDT has changed and invalidated our pointer */
 	info.keyname = fdt_getprop(fit, noffset, "key-name-hint", NULL);
 
-	ret = info.algo->add_verify_data(&info, keydest);
+	if (keydest)
+		ret = info.algo->add_verify_data(&info, keydest);
+	else
+		return -1;
 
-	/* Write the public key into the supplied FDT file; this might fail
+	/*
+	 * Write the public key into the supplied FDT file; this might fail
 	 * several times, since we try signing with successively increasing
-	 * size values */
+	 * size values
+	 */
 	if (keydest && ret)
 		return ret;