Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3528048pxj; Mon, 24 May 2021 08:42:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE+80FEXvAxPZMlORkPKqXs2QayMSMl+9yjCuQplpE/JuNgb7gpS5UuvD1FwtzeeQfqud8 X-Received: by 2002:a05:6e02:4ac:: with SMTP id e12mr16127693ils.21.1621870964655; Mon, 24 May 2021 08:42:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621870964; cv=none; d=google.com; s=arc-20160816; b=LqPHM4vRwz2gMf2FWPRak0fztm6kZSJLmudUNBhxSg00HT3V3qY9rLJwWzqadosnR7 vRdS9zsxgN0yyGtlblMqcD6tBSGUS3uNIJNGQzle3HQYunSso3bwtJjvg1XhF8gPYLvf dKDCjx9++6OzFUhIop/rKJCFGznKAxnVyWUWdJFMlZokY0I+0Y15zM0FbyfVXhWw3JdG H0YABCOBx1lwRHDadw8dKKknCLawTjMT866AjdfYqEWMjqtgnkaIna7OukmYy+mQa5dh ASwF+p6VbcI/+CYG++jdsWhIsuCBpXyyh/feWDWp7Y6Ov7M9BBAPW6fE5DE9Sq79nup0 WFuA== 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=OZYWdJU+nKyRQTgGnmYnTUZw1RE6ls7iBjWISrmYNrqKglcJKbbH7aw4YVlWbHcO6/ e8uO5/B/uGfbg2IA6NAXToMMWxVVLjsQqTGbKwvhTO4igSznMyA5OwzGCsQFmHwdNxAT UPLoSi6Hx4ysaI7fUbNaTyCQBQQmZc6WcnTp3JurESt+2m5nNFigqjeJU/rGhntZYhEf N8jqy0oy3TvlBuJUydjG00kVUFDxD2gffK0WD34ikEcpGvrF0D9iWePMGrLfiYxmcFqi dT//JmFJuD/j0020+oV/NYxkHfRpJpCZvBfV9gyPH+wGgSr3qUedNmjQZW1FDJhQEGLd R90g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EOkv6SMK; 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 17si14834120ilj.19.2021.05.24.08.42.31; Mon, 24 May 2021 08:42:44 -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=EOkv6SMK; 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 S233381AbhEXPnU (ORCPT + 99 others); Mon, 24 May 2021 11:43:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:57090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233603AbhEXPjF (ORCPT ); Mon, 24 May 2021 11:39:05 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 746476142E; Mon, 24 May 2021 15:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621870435; bh=y8tKCc8MNmhJbgdeqlnUMymJi7u75jq1rEAUQ5u/ucY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EOkv6SMKAVyNBasmcfvDrP0RDqlgmV9pO0IP7mbelcI826AXYnrH2mg9eG9/mkOfZ 6CHrUS6DmYLaqChExMuPBTxpqeSCO22kjQJJNa2sJ3Vo1W1YpZakHgGQ+kYuLM3Hed jTbAHRY0a4A9UXEU1mrtcLNe+ll9TX47wTKdQ5qM= 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.14 32/37] leds: lp5523: check return value of lp5xx_read and jump to cleanup code Date: Mon, 24 May 2021 17:25:36 +0200 Message-Id: <20210524152325.255677803@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152324.199089755@linuxfoundation.org> References: <20210524152324.199089755@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) {