Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3526363pxj; Mon, 24 May 2021 08:40:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxCGWsQ/SXbXbPHtHCR0lC0Qtif71gxhRegTBUxF2kp+/YnqlcA4lJejDYMWqyMGdsGXxKH X-Received: by 2002:a17:906:ae10:: with SMTP id le16mr23757989ejb.296.1621870823252; Mon, 24 May 2021 08:40:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621870823; cv=none; d=google.com; s=arc-20160816; b=oiZnZYupI79H3UedAzO4BdiiZKBt1GRJyAjJnRhiSM5UAQPhV+x4UNq3Sf27XZ/xbl XliYaCS0V7VCOwGa/kxtCP3TByoR22es0OmhKuFHZNILvL/ZNubpq1ckw1CxMizMFneF p9f2NVa11f1jhIvQFRG3qntBUajdO0noSA7DX6O6sdkNfId4ogzVFKLt/S447MpcKJJF 2inLOlcZpKYXtA/W1zNj2P1clX1A2IhgIlDw/IM2Ft3jYa/VhLwjzHHoQRrB19FGrVZk 5k1dR/BvqeqeJlF4VT1iNVYOM1lGxBzhHKlzkEc5owmM7I3EYTM0t2PIMo0Ui4AFNogU EXuQ== 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=XZHccDbOAkE7y+TRxqxcPVBD1o/5QJCjsx6CvRsqniY=; b=RLM+kAqvALKyIloXRMh4WwFvUWtOF2VwFHIusTrq1MsivESoNlbU3Ol+FKt05RTOZk 1KmCFORJCXDgLh1CiiSpCka+nQoi7XVY8TgVto3NPHhiEuTmkUsTXwSweaJ3Xt1QynjJ AoblTMFgP2lIi9cNDPOTqiWS9hd3iFvz+2LK7sUlAlDlMUuuDaxBuMcV2MKOXE6JJU8Y tjLfnBCY4DgGIXU+LmZcbbfsfz2GFji+BqSjzc3G+V/bBpRrprmnx1Bx91Kwrd/vW0dK k2M3BxA1qrdK8ASYJ7BC9TH5t7rwK5HVNaJDElIx7OJh4fPVYiXjg9gUJV4H1nOedNoV MUag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vIgOa+fC; 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 j20si12147642edq.307.2021.05.24.08.40.00; Mon, 24 May 2021 08:40:23 -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=vIgOa+fC; 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 S233979AbhEXPk0 (ORCPT + 99 others); Mon, 24 May 2021 11:40:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:50522 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233482AbhEXPg4 (ORCPT ); Mon, 24 May 2021 11:36:56 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 10E126141C; Mon, 24 May 2021 15:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870379; bh=y8tKCc8MNmhJbgdeqlnUMymJi7u75jq1rEAUQ5u/ucY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vIgOa+fCdWsEDxYkpvAJ/G1lSakAZzmxdz4BlJpzLvjHlMqPJVKS3fVtC66wyjqDv EwcMhODEGc9+KT2KiahLhTdstvxSwqZTQE6RJTbVgF7Nr/NqBkmOHIUXZpEMP2Vugi PYCFrJzRl5vzIN0e2Zgf8Wog6oeAOoUEooCIUF9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacek Anaszewski , Phillip Potter Subject: [PATCH 4.9 30/36] leds: lp5523: check return value of lp5xx_read and jump to cleanup code Date: Mon, 24 May 2021 17:25:15 +0200 Message-Id: <20210524152325.132767561@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152324.158146731@linuxfoundation.org> References: <20210524152324.158146731@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 @@ -318,7 +318,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) {