From patchwork Tue Dec 25 06:21:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kangjie Lu X-Patchwork-Id: 10742543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 214E16C2 for ; Tue, 25 Dec 2018 06:28:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 024F3205FD for ; Tue, 25 Dec 2018 06:28:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E67A4223A1; Tue, 25 Dec 2018 06:28:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF0E4205FD for ; Tue, 25 Dec 2018 06:28:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725827AbeLYG2w (ORCPT ); Tue, 25 Dec 2018 01:28:52 -0500 Received: from mta-p6.oit.umn.edu ([134.84.196.206]:56248 "EHLO mta-p6.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725819AbeLYG2w (ORCPT ); Tue, 25 Dec 2018 01:28:52 -0500 X-Greylist: delayed 398 seconds by postgrey-1.27 at vger.kernel.org; Tue, 25 Dec 2018 01:28:50 EST Received: from localhost (unknown [127.0.0.1]) by mta-p6.oit.umn.edu (Postfix) with ESMTP id A5CE9C60 for ; Tue, 25 Dec 2018 06:22:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p6.oit.umn.edu ([127.0.0.1]) by localhost (mta-p6.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0P1djWImONRl for ; Tue, 25 Dec 2018 00:22:11 -0600 (CST) Received: from mail-io1-f70.google.com (mail-io1-f70.google.com [209.85.166.70]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p6.oit.umn.edu (Postfix) with ESMTPS id 76938C4F for ; Tue, 25 Dec 2018 00:22:11 -0600 (CST) Received: by mail-io1-f70.google.com with SMTP id k4so15509568ioc.10 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=A4RJJvkrbU5VoCvXqOl65vCQ2nPQ0dr1G57PmOb/oswIHPVuygX21Dm4QVM+N0VDmu 0O1GSvcmrIsUosqSPw5CwycnWh5WIctrcZ330+XXJUFI9cMVxA5kx2gksuzeguNBqrl/ zsODTFgyQsH+ryD60jc/hC0PmZKzfiRZfvd8z81bNIlk6+m3Sla9nLj1zpdVo7YYXs0M KHmY9hmk9NhgoGRBHArHLiHX6uTQeaC0QUQKgx4ErkUuQu1oQ1SkX+pv1EV8h6tGqp7d RD3poMONVdWyjIeVuHmccKbmnk4/37C67eznZuoWOV4X/q+sVkdSswcX7UvZzJh/inaU 06gw== X-Gm-Message-State: AJcUukfe4+EUdB5i35Vdp/0/p/xLkEKgluIBsx49jbLwLtYpI9Zthi1f PklfNMgGtHO17QqyQvkyavgj5rAr+BQYBOvZXrAAvbMyo72ZDIFTKfcUMZEls+xowadXNrxUH0u BPnw/sDGELZz3Ux4GyC/xuhrYN/g= X-Received: by 2002:a24:1490:: with SMTP id 138mr11934382itg.101.1545718931078; Mon, 24 Dec 2018 22:22:11 -0800 (PST) X-Google-Smtp-Source: AFSGD/XfYXP9g0p5dbtxJzToqpEqkl3DO/LYjmVzYdwJ4WN3n6c51QaUNu/sdWj6l5AEoGDIt/Sjtw== 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-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;