Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3279505rwl; Sun, 2 Apr 2023 04:30:34 -0700 (PDT) X-Google-Smtp-Source: AKy350Yo1DbP4fDmnV2Q0isMBWuro4UeNADS7k+XWogqlxBtvoYs4jGtFMDE0RcW1rlU4Cj9NPJ4 X-Received: by 2002:a17:902:a416:b0:19b:107b:698e with SMTP id p22-20020a170902a41600b0019b107b698emr28705040plq.14.1680435033839; Sun, 02 Apr 2023 04:30:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680435033; cv=pass; d=google.com; s=arc-20160816; b=vO8ISyDTFT7Vblhv3umfQmlpSRA0uNDIFdRHYfefJXdvm16xjG8V+N56IbGurZ7/7B tyFTaJSucy47IIZnpv0XGNplwZBpOCuIoLsBR/ekgARLqp3ZjrOpOQ812IdZE3mzPN9i 3MNCCGww88eLvPhdWe1rl1yQFtijRlWOUaU8LERIC6yWeJ4YWcH28ay5kfXuV1ADTxhv fBvkcpFCRcoll+yegxALNO6bxWboRpWwM8tP4O/xc6kIkxabgff1YBYJ/L7BYJojSWnU xns7ZRuYvHWtI1XaQ/RhoZofyqR2sSEQ2g3aX16dpGwwVczmIXldfluSkEAMMieVYkdr LQMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=20X3HFLD0PCIwckyuLnAErqiyt22kmiUi0m0jrtysMQ=; b=FIy91yqNpmitgugi20clVvclfRwyICeaPCeB1qXbuTHVehu4KkhmIMqr2p0WlbNQIF hvHAQ6Bd2fQYEWdnx6n/e1PdFbIYnfFoR5FP4lQX9ea7PrkuKg7IYmzwad6m9pg1QlXU 9N56t1Ch2CTvgan7uMyk7nr7W2nRG0BT11WxzYnzt74aAm1tzf0rT07rjjYfoocinYzJ cHyYBNG49eVieO6OeeJq05wB0NC1GM/h/BYC8392kmSYo719wgNG96myjxIGUvlufH/s H2C+AlAjAiJUULY00YIouGK7+43RantOhvLL3tTDAzJADA7z9bH2II068LO4JkSCLblt 3pWw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=K41SYxjI; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kj12-20020a17090306cc00b0019f3064da41si5886637plb.383.2023.04.02.04.30.21; Sun, 02 Apr 2023 04:30:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=K41SYxjI; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230413AbjDBLNT (ORCPT + 99 others); Sun, 2 Apr 2023 07:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbjDBLNS (ORCPT ); Sun, 2 Apr 2023 07:13:18 -0400 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6D73AF0C for ; Sun, 2 Apr 2023 04:13:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680433980; cv=none; d=strato.com; s=strato-dkim-0002; b=SYastVuLe40ctMEpBc+3EC5HSgeIB+LitNtZaGybWM39JT6okEygDcQkWXwRiuv5Hj ePST8azQTVjkhZNpaN08HZOPUs3PX9qQEgGjir5sBOhfuYjLuoY8BBgq+1fzrJRMkgGh rcg5V+KWWRsgxv75xzADt+N8KuzKsDsL7lUPjsAo4NtfIWK8+pkwHmRR8WTTvUnxEOK1 9kw8ncONK6h+nn806oylqV5VdIH4IdJnTTdzVomAEMj9ckEdbeuJ9zyyo3CLVB48AUyD oV/4DberP64ZWOeLvpJ20jkG6Olasol2o0RVtUS7ztnhBvUi3+2QY4CMONa1uzr5C9+y iy7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1680433980; s=strato-dkim-0002; d=strato.com; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=20X3HFLD0PCIwckyuLnAErqiyt22kmiUi0m0jrtysMQ=; b=QdsFMRDX6aki/NAkRUhqsBkanG+cQHP/HkcinRdvdr/RPJIWjdZxGu/qngOHy7wU0U RF9IMQO3z/ebFTWAAIPKrlhytyPa9ahmE+uMwkQ0vzF6Y2a+5LTbrRAxfvNnpZ3myb+N P5HZoVBtzq25IAl+xaWZz9xehItpCiTPUQDNLaCiioOVCQIdUuMPIh1Yq/8t7d2o04NY Sp/YyGvoyOoBvK+dqZ8JZ6uv/tPB+memyX8ThA6EwJHUDItX7EzT0k8c/ZdcAQAo1XQx eJmAzrooORkFvO4Q+YRhWJqgqNaO1wEVBS3/vFP6mrGJ42zAFoWNkSoByKNht0HXIDaj rW2Q== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1680433980; s=strato-dkim-0002; d=goldelico.com; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=20X3HFLD0PCIwckyuLnAErqiyt22kmiUi0m0jrtysMQ=; b=K41SYxjIzYcgic5+TD9LYCtNs90pmQleRmBY3//U/qzuhpXAjedpumWGoV3J/CNMqG PIdi6Vi0u5vTDhrfzw8dJVJJgNUxHrFlMkonBsjfRFzukdYRRc9zH0D5jeZSFTIkGd+N XpguKMszMMvUcyBlWJiXXrPM2yWgVUqh0c/5TWEmus2HXH5vGZTDGCpI/6JPyvY9jGx9 +EJjcyRoCkMOD9lV2SFA+YSmw5cEWfmnyS3O6iSFGSLOP+lyVgqmxw8rFJTwZuv+LEtp 7q9oOjjT7qaO8z4T8iWCDh9KE6+25Q966tY2y78kMEK5atQYDfQRnvhc0x1P/f2OzzGl 1Opg== X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMhflhwDubTJ9o1iTDUhfN4hi3qVZq2PJ" Received: from iMac.fritz.box by smtp.strato.de (RZmta 49.3.1 DYNA|AUTH) with ESMTPSA id R24ce1z32BD0wL0 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 2 Apr 2023 13:13:00 +0200 (CEST) From: "H. Nikolaus Schaller" To: =?UTF-8?q?Marek=20Beh=C3=BAn?= , Pavel Machek , Lee Jones Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, "H. Nikolaus Schaller" , NeilBrown , Linus Walleij Subject: [PATCH] leds: tca6507: fix error handling of using fwnode_property_read_string Date: Sun, 2 Apr 2023 13:12:59 +0200 Message-Id: X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 96f524105b9c ("leds: tca6507: use fwnode API instead of OF") changed to fwnode API but did not take into account that a missing property "linux,default-trigger" now seems to return an error and as a side effect sets value to -1. This seems to be different from of_get_property() which always returned NULL in any case of error. Neglecting this side-effect leads to [ 11.201965] Unable to handle kernel paging request at virtual address ffffffff when read in the strcmp() of led_trigger_set_default() if there is no led-trigger defined in the DTS. I don't know if this was recently introduced somewhere in the fwnode lib or if the effect was missed in initial testing. Anyways it seems to be a bug to ignore the error return value of an optional value here in the driver. Fixes: 96f524105b9c ("leds: tca6507: use fwnode API instead of OF") Cc: Marek BehĂșn Cc: NeilBrown Cc: Linus Walleij Signed-off-by: H. Nikolaus Schaller --- drivers/leds/leds-tca6507.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c index 07dd12686a696..634cabd5bb796 100644 --- a/drivers/leds/leds-tca6507.c +++ b/drivers/leds/leds-tca6507.c @@ -691,8 +691,9 @@ tca6507_led_dt_init(struct device *dev) if (fwnode_property_read_string(child, "label", &led.name)) led.name = fwnode_get_name(child); - fwnode_property_read_string(child, "linux,default-trigger", - &led.default_trigger); + if (fwnode_property_read_string(child, "linux,default-trigger", + &led.default_trigger)) + led.default_trigger = NULL; led.flags = 0; if (fwnode_device_is_compatible(child, "gpio")) -- 2.38.1