From: Jonathan Lemon Date: Mon, 16 Aug 2021 22:13:34 +0000 (-0700) Subject: ptp: ocp: Fix uninitialized variable warning spotted by clang. X-Git-Tag: v5.15-rc1~157^2~190^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c8075728f4df477d94df2e4d23a95ee69ee9493;p=thirdparty%2Fkernel%2Flinux.git ptp: ocp: Fix uninitialized variable warning spotted by clang. If attempting to flash the firmware with a blob of size 0, the entire write loop is skipped and the uninitialized err is returned. Fix by setting to 0 first. Fixes: 773bda964921 ("ptp: ocp: Expose various resources on the timecard.") Signed-off-by: Jonathan Lemon Signed-off-by: Jakub Kicinski --- diff --git a/drivers/ptp/ptp_ocp.c b/drivers/ptp/ptp_ocp.c index 92edf772feed5..9e4317d1184fe 100644 --- a/drivers/ptp/ptp_ocp.c +++ b/drivers/ptp/ptp_ocp.c @@ -763,7 +763,7 @@ ptp_ocp_devlink_flash(struct devlink *devlink, struct device *dev, size_t off, len, resid, wrote; struct erase_info erase; size_t base, blksz; - int err; + int err = 0; off = 0; base = bp->flash_start;