Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp555746ybt; Wed, 24 Jun 2020 05:57:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfuEZOLwCCZ9M+43VV59XxkNLwnJrc37LL2Ntjz3W42aF45XZZyn35q5JB3r3jnOitIOYE X-Received: by 2002:a05:6402:22a5:: with SMTP id cx5mr27909530edb.246.1593003459847; Wed, 24 Jun 2020 05:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593003459; cv=none; d=google.com; s=arc-20160816; b=xo+9t+Hr5khNpSBeJYbyHQPO5k9u1sabo7QBkmSU1PSMOYZpdAQ+clbGC7tJHYvxXf cZQIXM2heSvtvfVA7cKh9ZlLFMaNDagHimjNK52s+NbH+/YcDws0JZo8YIvnamMLceXL KzL5i/x7P2qpUrlVcGkG61NWm6JpBytd+K4qc8LEt8qOQPFnxtO9gW9FrL7tXvvIV7rE cdmXyDfoqlRMmzGCe57gL75Sjxy5rpBbbe9wXEesjLJlbuhPb/YjFEdk5NTuL5v8aU4J gbo/Ir9hxzEy/+sGcSb/MJb8gDMeOElJsrnja75rmueba0HXw4sq7gRNA/CyUQBouPKC 3yOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=BudWo05ArRmRePLjA5xBNrNmyyzvRBGhzbvJwLCnkH0=; b=wwxCGIynB8EBjEwfgbhjjel8GEuBXPzvIR56EJOWLpd3Te26rDzNjfAHqYdWGM7l6N 4xh8kmxu1l6ZWlXysSAQ+09ysQ+wUU7CD09np7Qw/hiNIsy0pZRQmqmcTiIerFdurHah zf3lWeSnL8M7ITJvmiXtjTVqYrfixPtzbM5Q46MyBMY82/BoyC0tkh/iMGSgUHAy6Vmf pBi5uoWKl721XQorvxBhURay2mpO1vVmsrZfCR0zsmizAlCvaiEt7EWM03idP+RAWYsq ulfU/FTIwryB2qmjtmeE8ySuur3qYe1qs7s3QwtWV5y0VyBSH8rBwOc25jR16kXd0kXe ozSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VovrAuXb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s23si5292261eju.242.2020.06.24.05.57.17; Wed, 24 Jun 2020 05:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VovrAuXb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2390898AbgFXM4L (ORCPT + 99 others); Wed, 24 Jun 2020 08:56:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388942AbgFXM4K (ORCPT ); Wed, 24 Jun 2020 08:56:10 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1D16C061573 for ; Wed, 24 Jun 2020 05:56:10 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id x11so1028299plo.7 for ; Wed, 24 Jun 2020 05:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=BudWo05ArRmRePLjA5xBNrNmyyzvRBGhzbvJwLCnkH0=; b=VovrAuXblBSTzq/6/XfemWZFoVjtapdBL6Wz1qU3Phgj++1U+GZ/hPAjZJP47h5hUi YQ/jkQ4l++Nn5DV1sG3GyQ/cxt37cIN49uMWF3Q0AFZpiHGMrUdmEnDK7DDcuKj4y2xA zM/tKFhuy/DLuPAj0FBsgEt4P9Po08dQxDQvTwUN+OzfAcGuW2GlVNzOkUbAlE5wqHij WdCzPRHrwIjOwaeA+n06Na5N/FyaVipSNKG+gG18MtoC4490gFP5fa/UYsnf9ydXTcpi IL78By7AvuimCTAqJ/f39CPa9CJXlp96nEtVQNCpYR9cHuG2/HCdx4C2FcqJ9SG5w248 gvpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=BudWo05ArRmRePLjA5xBNrNmyyzvRBGhzbvJwLCnkH0=; b=bxCCk1TeCL+tcTmNusP5QMTmelanhbXND9Fo3ESbD7SaZtPe7miiigUmcjBfYpUmQX 0cK+OInLYJrGI7BoE+OzFh070NzEi1LJPuOcNMxcLp+WcXTYWS/xftzsBo+kDQUkgFou H/yqikOaInFhpBDHRGT6BiR42Qi+nPaagFFF/28ON1AoV6+RgUvi7ojZJ4WouJxBFg86 VgzJSAIGylpKZ1wMvxt7TRfboEcp7LyVapPSEYe6k2CXkOo1IdTXhvF3+RIO41doBYRo 4VJgd+WF0ixkTWZ4Wx8tdmTlsLoSqYQicOKij1JahjmiPPiErkdrAqA7BlkAHH74Q7M9 TnyA== X-Gm-Message-State: AOAM532Bm/29lBqIIXYbtlKogc0fnNupPBVAjcRu9KCoZKzahWNyr/D9 2FN5EPFBDZmHnUvcvasipCwYzJKzz9mpFzrkggU= X-Received: by 2002:a17:902:b206:: with SMTP id t6mr27559277plr.262.1593003370435; Wed, 24 Jun 2020 05:56:10 -0700 (PDT) MIME-Version: 1.0 References: <20200624114127.3016-1-a.hajda@samsung.com> <20200624114127.3016-4-a.hajda@samsung.com> <2203e0c2-016b-4dbe-452d-63c857f06dd1@arm.com> In-Reply-To: <2203e0c2-016b-4dbe-452d-63c857f06dd1@arm.com> From: Andy Shevchenko Date: Wed, 24 Jun 2020 15:55:57 +0300 Message-ID: Subject: Re: [RESEND PATCH v5 3/5] drivers core: allow probe_err accept integer and pointer types To: Robin Murphy Cc: Andrzej Hajda , Greg Kroah-Hartman , Jernej Skrabec , "Rafael J. Wysocki" , Jonas Karlman , Bartlomiej Zolnierkiewicz , Linux Kernel Mailing List , "open list:DRM DRIVERS" , Russell King - ARM Linux , Neil Armstrong , Mark Brown , Laurent Pinchart , Daniel Vetter , linux-arm Mailing List , Marek Szyprowski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 24, 2020 at 3:37 PM Robin Murphy wrote: > On 2020-06-24 12:41, Andrzej Hajda wrote: > > Many resource acquisition functions return error value encapsulated in > > pointer instead of integer value. To simplify coding we can use macro > > which will accept both types of error. > > With this patch user can use: > > probe_err(dev, ptr, ...) > > instead of: > > probe_err(dev, PTR_ERR(ptr), ...) > > Without loosing old functionality: > > probe_err(dev, err, ...) > > Personally I'm not convinced that simplification has much value, and I'd > say it *does* have a significant downside. This: > > if (IS_ERR(x)) > do_something_with(PTR_ERR(x)); > > is a familiar and expected pattern when reading/reviewing code, and at a > glance is almost certainly doing the right thing. If I see this, on the > other hand: > > if (IS_ERR(x)) > do_something_with(x); I don't consider your arguments strong enough. You are appealing to one pattern vs. new coming *pattern* just with a different name and actually much less characters to parse. We have a lot of clean ups like this, have you protested against them? JFYI: they are now *established patterns* and saved a ton of LOCs in some of which even were typos. > my immediate instinct is to be suspicious, and now I've got to go off > and double-check that if do_something_with() really expects a pointer > it's also robust against PTR_ERR values. Off-hand I can't think of any > APIs that work that way in the areas with which I'm familiar, so it > would be a pretty unusual and non-obvious thing. -- With Best Regards, Andy Shevchenko