Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1102250pxj; Fri, 21 May 2021 06:33:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0vMkSpR2DlDIv2ej4ib78QFTI2m2J/9nJxdSM5Z9Xg/qFV4xcYJut4ocfCh3oMiZyYsGy X-Received: by 2002:aa7:c9c9:: with SMTP id i9mr11179245edt.17.1621604023958; Fri, 21 May 2021 06:33:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621604023; cv=none; d=google.com; s=arc-20160816; b=i5Qp5SJUTK6Nz98Fl/jAdSW2UEUL0FC+wYX7cdoktt/RgsOVvEAhyk+7h3SjkAfHzk KUqC4ZAVpJIuvVwBBYiJF3GkUIE8gnLkXennx+WPrifv8SL4nzLnbttt9jm8YeHiW1Ai YUciuNmPh3n6TjLCAn0BfdfQs7RXGtZbAceBuizKMTM+0KSbec/6nZ+3v/9nuOCaD9wH qxV8puXzDcca50POfOD2rjGtPhQH6ChCK1lbQMcGA6SO714q7rAAJy4XoLggcIux8pf/ cpEuwtwDgorib0xWa3DY+CWny3Vg/reAviDYe628Ps7GmeQ2yOaX0vQ5k8BqM246pITI C1/w== 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=FYTaWwfm3QROhcwX/aUHvjSyyM0wTPBO8vdBpVZtKz4=; b=FK8ZJMY4bh+I85I1OhiMjufD1yPYbusvhxyEqTo+StKgvaMN3SwtKUUzE/GOKKWOES GiYt4y2mdDbJYxAspU2zyRhPnAKxgaaQvlYChwyiKBuzb4WXAx8wSoXt8qYUvODDlgb/ RzkxOyUW26Icg1iPUJtYX2GyssGzRDgIXeMnHJZ0g3Yl/G/8+xtmTKe+5x6P1qo8K+rb 0ErX/I35tdtz1HvfbnTUHBKptE8jWZKy5XTPeEYvz8sDZa97bm54ngItaF2v+vTVtWvd auTGk2xYLkYlLuG+TkK3ULAekrYUYvbdDipfNOrUA5PjmT56hVtn7em7ssTxJfkrILNs UMuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=A55JpB1j; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rl19si5377418ejb.50.2021.05.21.06.33.20; Fri, 21 May 2021 06:33:43 -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=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=A55JpB1j; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232380AbhEUNch (ORCPT + 99 others); Fri, 21 May 2021 09:32:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232172AbhEUNch (ORCPT ); Fri, 21 May 2021 09:32:37 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2147DC061574 for ; Fri, 21 May 2021 06:31:14 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id n83so16622733ybg.0 for ; Fri, 21 May 2021 06:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FYTaWwfm3QROhcwX/aUHvjSyyM0wTPBO8vdBpVZtKz4=; b=A55JpB1jUFRqlWxwgK1BVww09N9MwOR2hRPz1RqTYc2OKY7rDml7CD4ECC2ZiOizyh SIZJL6KVlzT/7IoylesL0LXmiwqxawosLNbTxAn6iHU7BevrQM7hC5mypff0Hq04FgD+ aDyBBnbW/0jzJ9hW8zf6GSWbN8YnEaoSI64YasDOaYld0NnHJlTKJ7Di7huV6x5oik2y FsxJns6A8hhjrpsZfLk4aTjbyOg9weudo1LwQJNizCMsTseNZYuKw2K53qm+28dd4Etr QkNEiFaHOcv/6GqOgqvahWEv/1fmJ6OKKtxvs5qWNi8OymKOOX1KY+jA4xRNCZqNOVA1 71EA== 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=FYTaWwfm3QROhcwX/aUHvjSyyM0wTPBO8vdBpVZtKz4=; b=dAJbqcamqvywpOJZigfVAxxKsWLJNhOpPvuJiesmN+gMSSblGgtNpYgFNB0041Lrgd hwAzPqOsmRlEAv/X6XSXz1C+0OZnq0SqD1ZjTvYzCLyO80Sy7cUU/aNe5oB0g51dtB8b kHUWvCFCrjgSdpKaK0JsRC/dW+2MoBunkhIkynUAziK2fy134Xsz9kMX/Yj3ap2PUjP3 UjBHnJfY4la3Cjzsn57hcMesZVPX1ts8YT/XjizjcikFH6eImjYVYjQUh3TtCfMzVKP2 lZ8iq8xG3RPc98NvXrbW0JfAi3g5a9Z3zfo8EeHl1WPmbjcQU/uTHZuScONV6aKZNvEc I9Kw== X-Gm-Message-State: AOAM5311HdwC+IFXroRHOzKCeXQ8D2K7DIj/f0DAzalCCEIMA/wLJHxU CwVaJmFmOpzTB3pHO3axsl3g2jBG9q82DSlKK1dzpg== X-Received: by 2002:a25:9d86:: with SMTP id v6mr14593522ybp.366.1621603873465; Fri, 21 May 2021 06:31:13 -0700 (PDT) MIME-Version: 1.0 References: <20210514085627.11230-1-aardelean@deviqon.com> In-Reply-To: <20210514085627.11230-1-aardelean@deviqon.com> From: Bartosz Golaszewski Date: Fri, 21 May 2021 15:31:02 +0200 Message-ID: Subject: Re: [PATCH] gpio: gpio-adp5520: cleanup probe error path + remove platform_set_drvdata() To: Alexandru Ardelean Cc: linux-gpio , LKML , Linus Walleij , Michael Hennerich Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 14, 2021 at 10:56 AM Alexandru Ardelean wrote: > > The platform_set_drvdata() call is only useful if we need to retrieve back > the private information. > Since the driver doesn't do that, it's not useful to have it. > > This also means that the 'err' label can be removed and all goto statements > replaced with direct returns (with error codes). > > Signed-off-by: Alexandru Ardelean > --- > drivers/gpio/gpio-adp5520.c | 18 ++++-------------- > 1 file changed, 4 insertions(+), 14 deletions(-) > > diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c > index 0386ede53f3a..c55e821c63b6 100644 > --- a/drivers/gpio/gpio-adp5520.c > +++ b/drivers/gpio/gpio-adp5520.c > @@ -113,10 +113,8 @@ static int adp5520_gpio_probe(struct platform_device *pdev) > if (pdata->gpio_en_mask & (1 << i)) > dev->lut[gpios++] = 1 << i; > > - if (gpios < 1) { > - ret = -EINVAL; > - goto err; > - } > + if (gpios < 1) > + return -EINVAL; > > gc = &dev->gpio_chip; > gc->direction_input = adp5520_gpio_direction_input; > @@ -148,18 +146,10 @@ static int adp5520_gpio_probe(struct platform_device *pdev) > > if (ret) { > dev_err(&pdev->dev, "failed to write\n"); > - goto err; > + return ret; > } > > - ret = devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev); > - if (ret) > - goto err; > - > - platform_set_drvdata(pdev, dev); > - return 0; > - > -err: > - return ret; > + return devm_gpiochip_add_data(&pdev->dev, &dev->gpio_chip, dev); > } > > static struct platform_driver adp5520_gpio_driver = { > -- > 2.31.1 > Applied, thanks! Bartosz