From e73695f0139a1f0c520c4c7abef421cc23119f8a Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Thu, 30 Oct 2025 10:28:23 +0100 Subject: [PATCH] Use symbolic return values in pickit5_open() --- src/pickit5.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pickit5.c b/src/pickit5.c index adbd855d..8cb6e357 100644 --- a/src/pickit5.c +++ b/src/pickit5.c @@ -568,20 +568,20 @@ static int pickit5_upload_data(const PROGRAMMER *pgm, const unsigned char *scr, static int pickit5_open(PROGRAMMER *pgm, const char *port) { if(!pgm->cookie) // Sanity - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; pmsg_debug("%s(\"%s\")\n", __func__, port); union pinfo pinfo; LNODEID usbpid; - int rv = -1; + int rv = LIBAVRDUDE_GENERAL_FAILURE; #if !defined(HAVE_LIBUSB) pmsg_error("need to be compiled with USB or HIDAPI support\n"); - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; #endif if(!str_starts(port, "usb:") && !str_eq(port, "usb")) { pmsg_error("invalid -P %s; use -P usb::, -P usb: or -P usb\n", port); - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; } unsigned int new_vid = 0, new_pid = 0, setids = 0; const char *vidp, *pidp; @@ -613,7 +613,7 @@ static int pickit5_open(PROGRAMMER *pgm, const char *port) { // First: Handle VID input if(sscanf(vidp, "%x", &new_vid) != 1) { pmsg_error("failed to parse -P VID input %s: expected hexadecimal number\n", vidp); - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; } } else { // VID space empty: default to Microchip new_vid = USB_VENDOR_MICROCHIP; @@ -622,7 +622,7 @@ static int pickit5_open(PROGRAMMER *pgm, const char *port) { // Now handle PID input if(sscanf(pidp + 1, "%x", &new_pid) != 1) { pmsg_error("failed to parse -P PID input %s: expected hexadecimal number\n", pidp+1); - return -1; + return LIBAVRDUDE_GENERAL_FAILURE; } pmsg_notice("overwriting VID:PID to %04x:%04x\n", new_vid, new_pid);