Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3551333pxj; Mon, 24 May 2021 09:11:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvxQ09IzTZ0Djh5rMQHNkObr+UDtCXRag1APU2X1r2hL7zfrr8MjiO7u6DG2GV5rKmN6Mo X-Received: by 2002:a5e:c708:: with SMTP id f8mr16551953iop.198.1621872677141; Mon, 24 May 2021 09:11:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872677; cv=none; d=google.com; s=arc-20160816; b=gOnjQCVJkY8i6f01/3GEbR39O8qZ5l9hzJh7eSCCT12+/Wzet7CO6/1Z/9oMP+XydZ nIR5hQejMi4ND5ZA/dwJzxCaJonzUwDrPrV0Ju02ozVelsKU5Dwfbycreg2n/Ym4XYzK agz0dMLhoMhqZjWBLWYkEhdREPg9N/Mhz5Hd6O+GcwmUnmAg6UXMiPkYr0sYxlBY47pO TyEr8uf5MxK5J4CiMmaqh/YEp1RdzLUtdnGrtMIVUf9DHDe8eQtaLBL4kmJwlDMwUxQY IrfVgKljhaREtetZ78dW13tJx7SCJbdWpjvTqpeV7Nt+UB5fGXkrJRGMDhlMIX941ebz hN7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NC8KulwuKglOLxWlWd8Q/OiV8s3iJFrJKcRBwm8/Xtg=; b=AOSO1cSmwYNte/BI7J7Q55yf8dyC9JZhxmuhVas2NaTcDZD0kuHWE79XgPK3wDFO+J yG7oBhEqeKPAoKcX/6Hw/Hna3I2YuOqNsyv2Equsy4YI8C18i4koB5PjSrjPpRPQjnhe 6d5nZB+WvaSgfqA7m+STos9UYfxNHG02Xty6tvcgcvzmJ2jv8ERSABR/yb2sRryrrktR Py0fT2f5zJAU381Yeix3ipxlBAb4hyem+rM17YpUtci7Iu9O69rdDLGK1pdwOglSjcjs OLvfmcWqEpE35or7lbo2Fc9Enaojb6AQoxpEEqyKBkmlXLT9x8iSExSsl7jleUwyCWPJ vBEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BhQg0Btm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d8si13985466ilo.3.2021.05.24.09.11.04; Mon, 24 May 2021 09:11:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BhQg0Btm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237703AbhEXQJN (ORCPT + 99 others); Mon, 24 May 2021 12:09:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:46680 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235157AbhEXQA7 (ORCPT ); Mon, 24 May 2021 12:00:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8E88C61996; Mon, 24 May 2021 15:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871190; bh=0DVwXL7PYrs3JfPmlESgZ3BmiRo0C+ub21RL2mKSP9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BhQg0Btm4kEmybwQUjTIKckWrqbiVnD8W5F6To0UHV4znDdIpXu15aj7PY58F7Tyn KkXkHrdFhiCx//WfARdsWy71WjlJyS5vk+Zj4qnu6Ua48j6w75fa4qhnpcVlOD2edK q+VR0uXsnLIzRg+UmlzLzVXW5wHyVZf581QOsnHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacek Anaszewski , Phillip Potter Subject: [PATCH 5.12 115/127] leds: lp5523: check return value of lp5xx_read and jump to cleanup code Date: Mon, 24 May 2021 17:27:12 +0200 Message-Id: <20210524152338.751211928@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Phillip Potter commit 6647f7a06eb030a2384ec71f0bb2e78854afabfe upstream. Check return value of lp5xx_read and if non-zero, jump to code at end of the function, causing lp5523_stop_all_engines to be executed before returning the error value up the call chain. This fixes the original commit (248b57015f35) which was reverted due to the University of Minnesota problems. Cc: stable Acked-by: Jacek Anaszewski Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20210503115736.2104747-10-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman --- drivers/leds/leds-lp5523.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -305,7 +305,9 @@ static int lp5523_init_program_engine(st /* Let the programs run for couple of ms and check the engine status */ usleep_range(3000, 6000); - lp55xx_read(chip, LP5523_REG_STATUS, &status); + ret = lp55xx_read(chip, LP5523_REG_STATUS, &status); + if (ret) + goto out; status &= LP5523_ENG_STATUS_MASK; if (status != LP5523_ENG_STATUS_MASK) {