Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp8101952rwi; Tue, 25 Oct 2022 02:28:28 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4VuIbFmmo1SspcHYCjG/+sSIWTwQzKfJKaDTXG6Ki9POSsp8A4yD9ylaMVWd4Y4Vjqsb3s X-Received: by 2002:aa7:ca50:0:b0:461:9845:d9d2 with SMTP id j16-20020aa7ca50000000b004619845d9d2mr12549303edt.163.1666690107999; Tue, 25 Oct 2022 02:28:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666690107; cv=none; d=google.com; s=arc-20160816; b=C5+41ofbwv1uqU00Dz96ot/+3DCofAjJWmONq3WG3RSnw7YKuE7Qh547NelHRcRU0Z Y6894HwhnJ/epHBHBJFrSoW1RsfnFuvp0PFPXygcvyjsuG9Gntl/c4+oTfYqD9LkSDfT 0v7D5vfLlw+ROJENcyTHk+MWLHddR4SM8xNORVZKLWmhMlnEkyjtQYIv6IeT4m+YHTjq ytg37Cmbxp54KtES2DLrgEqv58BIInhtAzdg1WEZ0D1hJ80xvyhofnEUrwCUzKJRQmBq xicPb0ArFxRgs9Lu2JeoUhYpKllJddAVDSlNlPZPNpol2x70lAYC4KdpqAuahd3DMcOh VeXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=IVmb7Ipf0fGtdJRMdt/0DgQQIw+22t1OebaDr8qjLYQ=; b=tP4c/DB6BoxTcr1cd8AJ0x9sPZUxwAJ5L9UevV+x96cRDB1Zj82p9Fd6m1To4nLTd1 S+nmaGqSXxeMKEPygB0CqM+AEFOQvkKw07ngNfe22XHWM4sv6Od5Fr9bCyZJX7Rwr1w4 9J8CRXQLN23AgCY0k6G1Z8I3lKATvzz3lNZM4PiIRLzuzV94n5WtSRjWSY/NPmgqObta vrhztspbBdYgC8H0PoRoNtl09kMz2lQFOoZr6m21Qi9TjwEZDSZ5Ut0v5d189obwtcIC UTymcjoRQ5D8PBB0kNQaojzY9M9BVLoFP4TlbBmUE7HW+eed1/wI4E41cfYo6rRA0yZb DATQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hAEzo6xQ; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qw5-20020a1709066a0500b00780636887fesi2410799ejc.797.2022.10.25.02.28.03; Tue, 25 Oct 2022 02:28:27 -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=@intel.com header.s=Intel header.b=hAEzo6xQ; 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=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231463AbiJYJXb (ORCPT + 99 others); Tue, 25 Oct 2022 05:23:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231668AbiJYJWu (ORCPT ); Tue, 25 Oct 2022 05:22:50 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C9D11143; Tue, 25 Oct 2022 02:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666689516; x=1698225516; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=WSlcowHN6Wq7+NjnXUQwOTVXdTNBu8zi0Wfnmzb3i0E=; b=hAEzo6xQholThH5HW9nt0XWzZxqnQpbh60U392Gr7XnkR68DXVsFV5Nj 1yFSLUQ/53+QlOhOYGPXf+RZxGQWPlJ5nWzkj2HjnmUE10lYtpsHjmvLc 52Xi0N8jGEtc+fY5Wmu/hYlZga7S+DyqYsgZ+RyUgUiKeKOxBLJ74T6vU M3Y5YI9XUkX7CcBSkWfVSMiRqpOl4SxkfqyXXsLb8iOGwysevQSv/4eW4 bg+qgezcEr3c8rUVMpWajgrLJKNkmMi2gnQWMWyr77HgmpIMJrCVV9yCw e6eW6Pg5SmsXDvG0FEyuI67fWdnaCkirBg/69YAB6EQbuvrNV/xo18kWp w==; X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="371844818" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="371844818" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Oct 2022 02:18:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10510"; a="720786423" X-IronPort-AV: E=Sophos;i="5.95,211,1661842800"; d="scan'208";a="720786423" Received: from smile.fi.intel.com ([10.237.72.54]) by FMSMGA003.fm.intel.com with ESMTP; 25 Oct 2022 02:18:33 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.96) (envelope-from ) id 1onG4t-001v5D-1l; Tue, 25 Oct 2022 12:18:31 +0300 Date: Tue, 25 Oct 2022 12:18:31 +0300 From: Andy Shevchenko To: Matti Vaittinen Cc: Matti Vaittinen , Daniel Scally , Heikki Krogerus , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" , Wolfram Sang , Akhil R , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org Subject: Re: [PATCH 1/2] drivers: fwnode: fix fwnode_irq_get_byname() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED 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 On Tue, Oct 25, 2022 at 11:50:59AM +0300, Matti Vaittinen wrote: > The fwnode_irq_get_byname() does return 0 upon device-tree IRQ mapping > failure. This is contradicting the function documentation and can > potentially be a source of errors like: > > int probe(...) { > ... > > irq = fwnode_irq_get_byname(); > if (irq <= 0) > return irq; > > ... > } > > Here we do correctly check the return value from fwnode_irq_get_byname() > but the driver probe will now return success. (There was already one > such user in-tree). > > Change the fwnode_irq_get_byname() to work as documented and according to > the common convention and abd always return a negative errno upon failure. ... > + ret = fwnode_irq_get(fwnode, index); > + Redundant blank line and better to use traditional pattern: > + if (!ret) > + return -EINVAL; > + > + return ret; if (ret) return ret; /* We treat mapping errors as invalid case */ return -EINVAL; > } -- With Best Regards, Andy Shevchenko