Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4322806imu; Mon, 24 Dec 2018 22:25:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Dih1LE8B9KJoA7YcNPbRNUUVfkKblXkJFkEQJmOVl+pvS4y08y9LupyV4wSoiUnurjuBu X-Received: by 2002:a65:60c2:: with SMTP id r2mr14807909pgv.393.1545719121900; Mon, 24 Dec 2018 22:25:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545719121; cv=none; d=google.com; s=arc-20160816; b=p2xZCjo0Y5V0Z4U+lTd9kZRdu+7ykrZ25Amc7tp+utDwbk8pN3pn5QuiIur7/1jOEq H+nbLeb0dLixpEcsd2u9xxBh0HUXnfP1Mn26hZ6fLbNnNiWJSi2Wep72RzUQIknKV7PH mGKZRMODFcoAmsE5DPtcIHymxNAS61fpKsDyIXBzNs/GU4xAO6M4EqBfKrTx8s8K0UJf FnffRjeo3eQpkYzdIq04fjXS5vKRetuFaqChAVeszRUJkyHPKG9m2rE3aXDZJelr0Gb5 A6VDBBVPRLQOZ+9uiQoQqSgjfQ/Aboc6EcQv6Xyt76m5hpXoN4Gct7z5iREcQWuwfw5P oY5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=a9GyhpuUrRYBNp+M48bV8E+CTjRuEk+Lrbj7GFJck90=; b=JQBT5J/y0Uy8Q8t8YqOxHB268W6eASZe68Wr+iIqcz+EckCXa4fYjJ/GDnEycqDkXX SBWtWhTNnS4HOuo7q4DAt4mLfBSe5V4mTm78Inv7455cfm2eP/XZEhrkTBktQvWBp1wd gJaUq4qHv94iFzTGqs0OXkdsNH1Jq+E42ST6/KjJ6Dc7d8iCRHtytZ7AHx9w4Q13W1IF u4sZcluETrzx05fCeTLdnEkX/HYg7O+05a+i7d7KhqzzFtXKZ0J3n4JK07wC2KGwOJ+V lXEaRNhjEZ8T+dOaMgvbQajYoj3nlQaxNENXxPf0XQuQUs0OaoU5/W2uCcXRqifiGjQH dY0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=Z7ToxyOi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b24si28715681pgi.308.2018.12.24.22.24.36; Mon, 24 Dec 2018 22:25:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=Z7ToxyOi; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725868AbeLYGWN (ORCPT + 99 others); Tue, 25 Dec 2018 01:22:13 -0500 Received: from mta-p7.oit.umn.edu ([134.84.196.207]:52272 "EHLO mta-p7.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725827AbeLYGWN (ORCPT ); Tue, 25 Dec 2018 01:22:13 -0500 Received: from localhost (unknown [127.0.0.1]) by mta-p7.oit.umn.edu (Postfix) with ESMTP id A9E98C0A for ; Tue, 25 Dec 2018 06:22:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p7.oit.umn.edu ([127.0.0.1]) by localhost (mta-p7.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id O3Rp3qjD5iLx for ; Tue, 25 Dec 2018 00:22:11 -0600 (CST) Received: from mail-it1-f199.google.com (mail-it1-f199.google.com [209.85.166.199]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p7.oit.umn.edu (Postfix) with ESMTPS id 7E6AEC06 for ; Tue, 25 Dec 2018 00:22:11 -0600 (CST) Received: by mail-it1-f199.google.com with SMTP id i12so15376901ita.3 for ; Mon, 24 Dec 2018 22:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=a9GyhpuUrRYBNp+M48bV8E+CTjRuEk+Lrbj7GFJck90=; b=Z7ToxyOiRh986lp4cKGMzmgPIHgZLmxP15UCQQvB4845LLqI1DtuVIU4lm7zxI/8dz Uwog4tsdgKQLyhFu9nMkeMXrRJyB/nrfDzxPRxD2KLHYkVjBqkPP4vpDuxu6EsFEUOeQ IG7tPD40d+htZJbsrQqmOxv0USI48d7lOKnZoy+q1wsNRHTmxG+A/qcsMYTh8vmX7lLv fzh++JaChkRYavTCr0qUPFqhkpHVt1bYVhHhpj3DVkRmxbwCwSyyb6GtRH88daXfLJZY ZjcOBSrG/Bw66b7y8nxdsPiWO21BHQMUFWlZMmr/zI9cAT5Q1PIhTRfh/nDa96tlW3Fm kaUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=a9GyhpuUrRYBNp+M48bV8E+CTjRuEk+Lrbj7GFJck90=; b=uRWKgZCtkAFIA5f9e3JqZkuiwYTWOlIjfOsCkitepvVmtkbaRXb8buftyvSjvpyMlp Gn9eZ1URSvhl87NI/uzmogG2scan4/ewz4gXMnwk4CuZDjt4l/5Q2MIzTlN0bbQQWPii TFB9DIzlZ4Q/4pqk/pmI5UfsRUqLrOlSaOlh6HyQ+hqmod8EJAJz1TuoOrZIv191ojNO o87SaGlSuh9h/bZARmHbShbXODRaozVgq6/5Y4DCBiQSWZOlOy0pc4ZzqaIuWXOgcXmr EWSQuev705PPI7KG8/OC++/tYebbpw7kfAyCvzNSoz7efWJitqU8PoM60Kkqn6WG+RBJ K4IA== X-Gm-Message-State: AJcUukdkH+ezT6/URQbDGU2sOBFE9vbMeRIdcTZzLL35eaGA8h9vlaWY K7NLpjeCJ0YwgkvHbbq+lcvVhq7htjB3SITP7bOljSBx+Z5R3Qs5JLkLaxSuP1iX9ym7KVIptUL 0Vj27crulaifDwExxc/ZdqAr/8AaP X-Received: by 2002:a24:1490:: with SMTP id 138mr11934385itg.101.1545718931077; Mon, 24 Dec 2018 22:22:11 -0800 (PST) X-Received: by 2002:a24:1490:: with SMTP id 138mr11934374itg.101.1545718930776; Mon, 24 Dec 2018 22:22:10 -0800 (PST) Received: from localhost.localdomain (host-173-230-104-22.mnmigsc.mn.minneapolis.us.clients.pavlovmedia.net. [173.230.104.22]) by smtp.gmail.com with ESMTPSA id l11sm14963983iob.24.2018.12.24.22.22.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Dec 2018 22:22:09 -0800 (PST) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Lee Jones , Daniel Thompson , Jingoo Han , Bartlomiej Zolnierkiewicz , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] backlight: (adp8870) fix a missing check for adp8870_write Date: Tue, 25 Dec 2018 00:21:09 -0600 Message-Id: <20181225062109.66943-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.2 (Apple Git-113) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org adp8870_write() may fail. This fix checks if adp8870_write fails, and if so, returns its error code. Signed-off-by: Kangjie Lu --- drivers/video/backlight/adp8870_bl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/video/backlight/adp8870_bl.c b/drivers/video/backlight/adp8870_bl.c index 8d50e0299578..79901fb4fcd1 100644 --- a/drivers/video/backlight/adp8870_bl.c +++ b/drivers/video/backlight/adp8870_bl.c @@ -811,9 +811,14 @@ static ssize_t adp8870_bl_ambient_light_zone_store(struct device *dev, if (!ret) { reg_val &= ~(CFGR_BLV_MASK << CFGR_BLV_SHIFT); reg_val |= (val - 1) << CFGR_BLV_SHIFT; - adp8870_write(data->client, ADP8870_CFGR, reg_val); - } - mutex_unlock(&data->lock); + ret = adp8870_write(data->client, + ADP8870_CFGR, reg_val); + if (ret) { + mutex_unlock(&data->lock); + return ret; + } + } else + mutex_unlock(&data->lock); } return count; -- 2.17.2 (Apple Git-113)