Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8067158rwi; Tue, 25 Oct 2022 01:56:26 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7m4NJqwwShcszyBEgyJ2qkB94nkp1cvo2rmt8pqj1c0HJ6W7Ncylkqfs7kp/mx6AA/zm4y X-Received: by 2002:a63:8841:0:b0:461:24b7:a621 with SMTP id l62-20020a638841000000b0046124b7a621mr32404091pgd.277.1666688186009; Tue, 25 Oct 2022 01:56:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666688186; cv=none; d=google.com; s=arc-20160816; b=EaMbR/pJ9J2PaBhxQHN441pIOfA3qDoJJXb7B1vSalJ1eeyd2WACg26628A+Y4MnWm 9+f1WAgclsy2cUsbCMCBb985fHFHj5oalVmZz2LaVdqNI47KPnfAl2i7HIWfrHUwC3So VTg2AymXO6VU3cmkfiRhC1kniAEyzHBZ8LK+KQq/jHt86tW7+FdxcC4hyuBltLTW+938 fqvx6xZG0CY+t0iOXiEAA2o0IsxR8G5ToZeN2KWWm59FMuwl5GzUAFiMcOmtsY1JjubQ NNSbt373n7AJ8DIZTAgHMo48sXUbmo/MsFo1xnoZ5L5MxZU67/P/AMr1+93Uwdl+nqOk 0/WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=zg5ekEkGQyBExWxO4N/+w6IcGC29JHnmqKp59L1beUc=; b=DvUi1dZdHasAS8SuXjBqIxgevjQs2qxWf2IASEYiwqWk46zIF74BxWpAsK6Rd8aGGY Nm2Z7cO3bzv4leqvCOypNihXZM5szTueuMW/CZW26CtoCMHeb7M7pupumfODtWzVRF9A TFHNC49SvGPC/DtHMOgVSVQ735uS7WgHnuk+MarxFp7Vss2x4wzT+fCB/zBn010h3bE2 JLQkH+2PQw12wwMsT4NPTWS9gXZztKlM/vFXz11yFlTTYXDqxHdnPs4/eKQbDURphBHj onkAhe7jlf64edlFD4NPIsEdF/igwZxlG988rVJ0TxY5zv8mwzDM4v7P2dN9M6aIXX6P f37Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=IkZ3uca5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lb1-20020a17090b4a4100b0020c060f42cbsi13933187pjb.98.2022.10.25.01.56.12; Tue, 25 Oct 2022 01:56:25 -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=@gmail.com header.s=20210112 header.b=IkZ3uca5; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231314AbiJYHRh (ORCPT + 99 others); Tue, 25 Oct 2022 03:17:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229950AbiJYHRg (ORCPT ); Tue, 25 Oct 2022 03:17:36 -0400 Received: from mail-vs1-xe32.google.com (mail-vs1-xe32.google.com [IPv6:2607:f8b0:4864:20::e32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4292CC786D; Tue, 25 Oct 2022 00:17:35 -0700 (PDT) Received: by mail-vs1-xe32.google.com with SMTP id 1so10077800vsx.1; Tue, 25 Oct 2022 00:17:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=zg5ekEkGQyBExWxO4N/+w6IcGC29JHnmqKp59L1beUc=; b=IkZ3uca5Lhug0fWIA71T/QQjiHrzJM3bteiemgni7PXa2+8WbRVWjRYLPFwjWwxxeB S9scDXP35z8YWoUe87YffK1L7mx+reaB/v+hL32nGVxJA1P/tS6EqjtQQyVSfXnRwDUf B8mCYh4Z5/OH+/Y9AZ80nkqsykT19zWsLXzmhrIXvb18pMVLeHn5q+0EEKZW5U6PACvS Ue73slaFwERHHk2wkJkpuXkC9Jtgnovw3t07uSgmuILqYEePBKD4MwPWtcwoALblS/YR OIt9EoSBj3UVAuETl7cS8dEC3i+7LElUZrI4O+u7v1MfpmkF7qNM8CizWK7wD4iMddVC dk5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=zg5ekEkGQyBExWxO4N/+w6IcGC29JHnmqKp59L1beUc=; b=UtzbG+7rSrX1s21A+HFI4QioUZhgDkE4xg2kGzSsHgT9QNVcwOFZUHelGdUhDFrxWT MoEU5x7Tb3ZahhpOA9DHTFikddbBj9pLHofz7hWVsLvfbdWZ7CUaxG/7mIMEXT5/yYuV Gf54OpxJTTdYh4z0LDMZMNnhaDm4rh1l3faGYBD6ob5u65utgVBgaHWWGEbAslB+VV6O /+ZFATVbBAD6APZSsK3R3wlce0o2k0HDlTIj2zEseBhh66Smr+dRPyRmK/MnNlEv+SQv wpWyzW8LLu2/qb7WEVrYllQ0v/9n+IW34LKJ3pPhMqWJHQHFOVyCpDn5qHPDN00DUH4I F9mg== X-Gm-Message-State: ACrzQf1UVTf8QGWLsnexxt5Eb2S8pvGvQNdnSy3vBCjtLZaZGiU/ujJC mLfe+E3inZSJOCn7Pc1yfCSS1w27RAjKhs70tBgiqCUM X-Received: by 2002:a67:d38f:0:b0:3a6:ff31:efe7 with SMTP id b15-20020a67d38f000000b003a6ff31efe7mr20904389vsj.33.1666682254387; Tue, 25 Oct 2022 00:17:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Matti Vaittinen Date: Tue, 25 Oct 2022 10:17:21 +0300 Message-ID: Subject: Re: [PATCH] drivers: fwnode: fix fwnode_irq_get_byname() kerneldoc To: Sakari Ailus Cc: Matti Vaittinen , Andy Shevchenko , Daniel Scally , Heikki Krogerus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Wolfram Sang , Akhil R , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 ti 25. lokak. 2022 klo 10.06 Matti Vaittinen (mazziesaccount@gmail.com) kirjoitti: > > Hi Sakari, > > On 10/25/22 09:48, Sakari Ailus wrote: > > Moi, > > > > On Tue, Oct 25, 2022 at 08:24:24AM +0300, Matti Vaittinen wrote: > >> The fwnode_irq_get_byname() may return zero on device-tree mapping > >> error. Fix documentation to reflect this as current documentation > >> suggests check: > >> > >> if (ret < 0) > >> is enough to detect the errors. This is not the case. > >> > >> Add zero as a return value indicating error. > >> > >> Fixes: ca0acb511c21 ("device property: Add fwnode_irq_get_byname") > >> Suggested-by: Andy Shevchenko > >> Signed-off-by: Matti Vaittinen > >> --- > >> drivers/base/property.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/drivers/base/property.c b/drivers/base/property.c > >> index 4d6278a84868..df437d10aa08 100644 > >> --- a/drivers/base/property.c > >> +++ b/drivers/base/property.c > >> @@ -960,7 +960,7 @@ EXPORT_SYMBOL(fwnode_irq_get); > >> * string. > >> * > >> * Return: > >> - * Linux IRQ number on success, or negative errno otherwise. > >> + * Linux IRQ number on success, zero or negative errno otherwise. > > > > I wonder if it would be possible instead to always return a negative error > > code on error. Returning zero on error is really unconventional and can be > > expected to be a source of bugs. > > Agree, and I did also consider just adding: > > if (!ret) > return -EINVAL; (or another feasible errno) > > return ret; > > at the end of the fwnode_irq_get_byname(). > > However, such a functional change would require auditing the existing > callers which I have no time right now. Oh. I just did grep the callers. It seems to me that there are only a handful of callers in 6.1-rc2. Auditing those does not seem like a big task after all. So I guess I can check them if changing the return value is preferred. Yours, --Matti