Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3542750pxj; Mon, 24 May 2021 09:02:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWJg5bPDsF6hfiLjWUMYMHlY5rH4pvQ/8jUTkLEFb8YtoN6nyyj7J1oWDgxTDDvGsx7znZ X-Received: by 2002:a92:d983:: with SMTP id r3mr17006165iln.262.1621872131316; Mon, 24 May 2021 09:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872131; cv=none; d=google.com; s=arc-20160816; b=tL0BjpHsWLV0x12sNZR0KBN4K0cQKRJY6NxHTHsfXPdnxKMeHJjG2Ag1VxyVUY4hDg /jvHBWh2wRoXinZi/Xw+BZ6meD0OPzoZDQNUU8bQ8FmhLLiwgdtn13QYuGVNzseNXAW/ L7O7Ya3UABp7bWIiqqKhjrCYyQ5zf5gJRn4TkwefsFjlFqBt7QWLJGBpxidUarNPMSs+ usQm60EdWob703IsjuXh2MgdGcGMa6CRu1lDeRpvpjE0PtIw8zJ1GgbE0mm0VCgTRd2+ lFQeY1aL05iw6XcAfOQlolK2im3mvX4QxtF+vG0taDpweRpkYb9pPvJo9XJ4wZH7xGLm nOQA== 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=bft8qVotr6j8kwdcMAZ4T0zktwBtVNC04/N2v1ZYnAtXLMdN4Lulx0ID3e1UdfJ+Gq 5BK4om6DArZTXNe7FQfnF6SXr5PvNyQjhqfUqfFr+gS2B4qMS6MrJf80pgHqBpOhbIxP yZasEZWGHUQlgrqbnauE1+upUpkzRVbuKkPgffJ2t2C22MoqTkUIT1q8kZduj/9gYaNC KrbGdquto1Np6NSgoNQG7GujgN6GS18oC81YDT3cfobPPzmY4Zr9vZ5SKzuSWRglJIs8 9nR5RcE7t8AuYlZhXoYcfjxHeoGfJRA5hxDwrdeBcppuqpB8xHnfuKhtdQviQU4gHx/N tyhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zeKyyvgK; 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 m18si9571273ili.129.2021.05.24.09.01.56; Mon, 24 May 2021 09:02:11 -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=zeKyyvgK; 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 S235373AbhEXQBd (ORCPT + 99 others); Mon, 24 May 2021 12:01:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:38642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234056AbhEXPwD (ORCPT ); Mon, 24 May 2021 11:52:03 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 227E861613; Mon, 24 May 2021 15:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870727; bh=0DVwXL7PYrs3JfPmlESgZ3BmiRo0C+ub21RL2mKSP9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zeKyyvgKk+An9jZBph8FAxwn2UzR34YGF/BGkfB0udDQJBm3pk3Xogvk27/R/SN+j Fy/vGqV6pPnqqFLxo8R1wTja05JYZ/AaUd/m5gU206dFQDOiu6MCEEGqRWs0ciHpZH +GMOiz69eU26cwmb+0I4bv7/z0QK9ANrWQBi640U= 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.4 63/71] leds: lp5523: check return value of lp5xx_read and jump to cleanup code Date: Mon, 24 May 2021 17:26:09 +0200 Message-Id: <20210524152328.497045540@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152326.447759938@linuxfoundation.org> References: <20210524152326.447759938@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) {