Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752742AbdCHMav (ORCPT ); Wed, 8 Mar 2017 07:30:51 -0500 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35478 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752655AbdCHMat (ORCPT ); Wed, 8 Mar 2017 07:30:49 -0500 From: Arvind Yadav To: mjg59@srcf.ucam.org, pali.rohar@gmail.com, dvhart@infradead.org, andy@infradead.org Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] platform/x86: dell-laptop: Handle return error form dell_get_intensity. Date: Wed, 8 Mar 2017 17:52:27 +0530 Message-Id: <1488975747-32184-1-git-send-email-arvind.yadav.cs@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 819 Lines: 26 Here, dell_get_intensity can return an error. So we can assgine props.brightness as max_brightness. This change is done using Coccinelle. Signed-off-by: Arvind Yadav --- drivers/platform/x86/dell-laptop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index f57dd28..0891de3 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -2053,6 +2053,9 @@ static int __init dell_init(void) dell_backlight_device->props.brightness = dell_get_intensity(dell_backlight_device); + if (dell_backlight_device->props.brightness < 0) { + dell_backlight_device->props.brightness = props.max_brightness; + } backlight_update_status(dell_backlight_device); } -- 1.9.1