lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPDyKFrRC4Q4v+rZVVEaj3zdYdMGoO=WnLAocHnaJWk96zxmtg@mail.gmail.com>
Date:   Thu, 30 Sep 2021 13:24:51 +0200
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     linux-mmc <linux-mmc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 1/2] mmc: slot-gpio: Refactor mmc_gpio_alloc()

On Wed, 29 Sept 2021 at 13:17, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> Refactor mmc_gpio_alloc() to drop unneeded indentation level
> and double condition. This increases readability of the code.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/core/slot-gpio.c | 34 +++++++++++++++++-----------------
>  1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
> index 05e907451df9..e365d328f43c 100644
> --- a/drivers/mmc/core/slot-gpio.c
> +++ b/drivers/mmc/core/slot-gpio.c
> @@ -39,24 +39,24 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id)
>
>  int mmc_gpio_alloc(struct mmc_host *host)
>  {
> -       struct mmc_gpio *ctx = devm_kzalloc(host->parent,
> -                                           sizeof(*ctx), GFP_KERNEL);
> -
> -       if (ctx) {
> -               ctx->cd_debounce_delay_ms = 200;
> -               ctx->cd_label = devm_kasprintf(host->parent, GFP_KERNEL,
> -                               "%s cd", dev_name(host->parent));
> -               if (!ctx->cd_label)
> -                       return -ENOMEM;
> -               ctx->ro_label = devm_kasprintf(host->parent, GFP_KERNEL,
> -                               "%s ro", dev_name(host->parent));
> -               if (!ctx->ro_label)
> -                       return -ENOMEM;
> -               host->slot.handler_priv = ctx;
> -               host->slot.cd_irq = -EINVAL;
> -       }
> +       const char *devname = dev_name(host->parent);
> +       struct mmc_gpio *ctx;
> +
> +       ctx = devm_kzalloc(host->parent, sizeof(*ctx), GFP_KERNEL);
> +       if (!ctx)
> +               return -ENOMEM;
> +
> +       ctx->cd_debounce_delay_ms = 200;
> +       ctx->cd_label = devm_kasprintf(host->parent, GFP_KERNEL, "%s cd", devname);
> +       if (!ctx->cd_label)
> +               return -ENOMEM;
> +       ctx->ro_label = devm_kasprintf(host->parent, GFP_KERNEL, "%s ro", devname);
> +       if (!ctx->ro_label)
> +               return -ENOMEM;
> +       host->slot.handler_priv = ctx;
> +       host->slot.cd_irq = -EINVAL;
>
> -       return ctx ? 0 : -ENOMEM;
> +       return 0;
>  }
>
>  int mmc_gpio_get_ro(struct mmc_host *host)
> --
> 2.33.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ