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.8 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 83D94C433E0 for ; Sun, 2 Aug 2020 11:07:17 +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 522A92075B for ; Sun, 2 Aug 2020 11:07:17 +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="XOTYNuxm" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 522A92075B 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 C1D5D6E0D6; Sun, 2 Aug 2020 11:07:16 +0000 (UTC) Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8EB736E0D0 for ; Sun, 2 Aug 2020 11:07:15 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id h19so36730811ljg.13 for ; Sun, 02 Aug 2020 04:07:15 -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=XOTYNuxmvR/tnD0W5idQ3uzdSm6UGDVWkKcrJTTvF0lSxDOVljNJMUAO0rNu6Y0iPO epgbdz5C6zXmFkTCfcOtxR3xTfJZPa8itWyOGhOapK6Q1zmu//ys9sSjyX6Tbme1/wtM kdqZnyldmeiIw37dfmXShp4HXWXPdMeJZbtmzVST1/pjPw2KbedARgt9Ctk1NSbEYffy ocheOzLTFaEyuoq4cEtPqZNZyBzCgFzucyMgeklHUkmHbhtpSyAIIZM0hlEDMNTmbpG7 fqwTPeC114qLjazKYQ5EctkAeCOixJJq/GAFope+B0GIpD0WPkOWlY8qZDDLXCGwUhfn Lk+A== 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=aMYwZfi7ZlOZ3Xdxgqjz2Y8WmPK5QOFc2Axb9DL2rtKIdSycijwR+VInZ5J2Ltrodc 1Jq+O6+sBIwpNUOv2VRbYc2U/UzXRodQ8MDE2DmPJjYfMWPs27J2VmY35Uok+idJF8/G R2nl9k470vtn+D2UVJYFfK9mQUAgdBi4VZ3y8rW+xzCEZEQf9Nq/vsyFInbnuNEzoplF cIC5WTOrxrAzRYiPQ5umgIzTJFrLgTqokGCnKycM89jt7ZGbG+4kZeKr4rzoUE6iaYif aigS1qViePEExPFDZlfWfgnzniFa489+cjr0el9gnt78HUwW15CAzTnwM28k2JEAwNdj dhQw== X-Gm-Message-State: AOAM532EFGtGrWUFiEq0tNfi0YIKxUbuC4Gfx/YqyPW96kr652nfraxh +5SpqVgqrD/3R1rEj9XdgiOgfr5MndA= X-Google-Smtp-Source: ABdhPJweQZA0b3cyMvjKG6b71zKlMHPgsZyhZtl/0MSATopfH9rop/4peQ6GnrUvk4fLRdkw1HHLtw== X-Received: by 2002:a2e:8087:: with SMTP id i7mr5434385ljg.98.1596366433803; Sun, 02 Aug 2020 04:07:13 -0700 (PDT) Received: from saturn.lan ([2a00:fd00:805f:db00:b9d6:7e3c:5453:a61c]) by smtp.gmail.com with ESMTPSA id l3sm3045520lji.115.2020.08.02.04.07.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Aug 2020 04:07:13 -0700 (PDT) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Jingoo Han , Lee Jones , Daniel Thompson Subject: [PATCH v1 01/22] backlight: Silently fail backlight_update_status() if no device Date: Sun, 2 Aug 2020 13:06:15 +0200 Message-Id: <20200802110636.1018743-2-sam@ravnborg.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200802110636.1018743-1-sam@ravnborg.org> References: <20200802110636.1018743-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