From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2D63C433DF for ; Sun, 23 Aug 2020 10:45:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 859142072D for ; Sun, 23 Aug 2020 10:45:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J5x660c2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 859142072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E448E6E49A; Sun, 23 Aug 2020 10:45:56 +0000 (UTC) Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by gabe.freedesktop.org (Postfix) with ESMTPS id 896586E497 for ; Sun, 23 Aug 2020 10:45:55 +0000 (UTC) Received: by mail-lf1-x142.google.com with SMTP id j15so2971597lfg.7 for ; Sun, 23 Aug 2020 03:45:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N6N46LpxOxVN6dAnm9F7KtaktSmWE/xBhpj2MxaGLjI=; b=J5x660c2/IA/IV+ILWhui4IclOPYvqSTcXdYD4T6rNYSCqGqqQfyKGtQJ3av1telWb wgIKGaYkqZ3Z35H05g3DJSlEQ1IRnaiaw1ulgVEdIKIwpvFUY16YJseSkAGWBnxJ9OG4 TvqXcosjeidil4CxpFNCmH22G0TdQ83/bpxz/c/3NUvrAKJ+PYzNNCn3BRQi/nsWGrbT k+oPduiycGJ2gck364w5KnYthB1VN0LQzpMTQAVmj4lhKpAO7q7Qd1/Be5nz7uUE06zJ TPKoWBxWi5D/QpPR+pfdxMJNIJk/T7/9k35NxdGjbKuo2a4EZC9n1JbMB10Mjc0GeW7w wxeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=N6N46LpxOxVN6dAnm9F7KtaktSmWE/xBhpj2MxaGLjI=; b=FOF07Bk9L3/uJz+PLgNx5dIp9D/cA8YE2RfncLTKH876kTEJ1D3ClPKOGETO77uDE2 E40cEWhMkMduJr+dIkW+On/t5LrXS3i1BOdyfkS334mWz+ArbvX/7DRNyNeLPXUBK/f8 0mtwBX7CALqeglZOFbvK9ARds5ZWy7GteW8S4VVLAVswiq6LPICygEUlyMBtbtGuY5Wu U77DjR2L+RFeA1C/YKKq1rEpdOTpBjzfiQd4n5o48kGhikfrOOQu0eYn20kQCuwOa56x rcA4R07FF5IyVVikjuZiztMsTpq3gQXalau5uzVIBHJj//sKqzI9CcxeeyLKVhGnYu2O 7pwg== X-Gm-Message-State: AOAM532GbL150oozUeNTyGuwCB6HP6bg44QyAHgexiQz85xqO9za6e/S KSZ9386gPnM86jL8i9zNnU9W2Y1BG/eFdQ== X-Google-Smtp-Source: ABdhPJxqyh/kD2Eec9HkAD0Ekqj986e6MT1i+8V2dC2ET3JQmabFWklihGxyRh/kTyz6He0XQOvoTw== X-Received: by 2002:ac2:4d16:: with SMTP id r22mr422847lfi.21.1598179553810; Sun, 23 Aug 2020 03:45:53 -0700 (PDT) Received: from saturn.localdomain ([2a00:fd00:805f:db00:2509:20d7:e461:9c16]) by smtp.gmail.com with ESMTPSA id h13sm1516301lji.134.2020.08.23.03.45.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Aug 2020 03:45:53 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v2 01/24] backlight: Silently fail backlight_update_status() if no device Date: Sun, 23 Aug 2020 12:45:09 +0200 Message-Id: <20200823104532.1024798-2-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200823104532.1024798-1-sam@ravnborg.org> References: <20200823104532.1024798-1-sam@ravnborg.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daniel Vetter , Sam Ravnborg Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" backlight_update_status() may be called from code that does not have any valid backlight device. To avoid ifdeffery and too much conditionals silently fail if the backlight_device is NULL. Signed-off-by: Sam Ravnborg Cc: Lee Jones Cc: Daniel Thompson Cc: Jingoo Han --- include/linux/backlight.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 614653e07e3a..190963ffb7fc 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h @@ -348,6 +348,9 @@ static inline int backlight_update_status(struct backlight_device *bd) { int ret = -ENOENT; + if (!bd) + return 0; + mutex_lock(&bd->update_lock); if (bd->ops && bd->ops->update_status) ret = bd->ops->update_status(bd); -- 2.25.1 _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel