pickit2_spi.c: Use a variable to store the total packetsize

Instead of calculating the total packetsize multiple times, use a
variable instead.

Signed-off-by: Felix Singer <felixsinger@posteo.net>
Change-Id: I714054669e16dcf531a57174f9522b3af72d2754
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/66251
Original-Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
Original-Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71473
Reviewed-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/pickit2_spi.c b/pickit2_spi.c
index ebf0713..e364b06 100644
--- a/pickit2_spi.c
+++ b/pickit2_spi.c
@@ -201,13 +201,14 @@
 static int pickit2_spi_send_command(const struct flashctx *flash, unsigned int writecnt, unsigned int readcnt,
 				     const unsigned char *writearr, unsigned char *readarr)
 {
+	const unsigned int total_packetsize = writecnt + readcnt + 20;
 
 	/* Maximum number of bytes per transaction (including command overhead) is 64. Lets play it safe
 	 * and always assume the worst case scenario of 20 bytes command overhead.
 	 */
-	if (writecnt + readcnt + 20 > CMD_LENGTH) {
+	if (total_packetsize > CMD_LENGTH) {
 		msg_perr("\nTotal packetsize (%i) is greater than %i supported, aborting.\n",
-			 writecnt + readcnt + 20, CMD_LENGTH);
+			 total_packetsize, CMD_LENGTH);
 		return 1;
 	}