From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD309C433EF for ; Tue, 28 Sep 2021 13:27:35 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2184561139 for ; Tue, 28 Sep 2021 13:27:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2184561139 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BB1EB8322D; Tue, 28 Sep 2021 15:27:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Em5CzWIM"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0A5DA83223; Tue, 28 Sep 2021 15:27:29 +0200 (CEST) Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 31FCE83219 for ; Tue, 28 Sep 2021 15:27:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=rfried.dev@gmail.com Received: by mail-oi1-x232.google.com with SMTP id x124so29912634oix.9 for ; Tue, 28 Sep 2021 06:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hCosJQXQwV9fVXF2HO5osVu0+IYThhw1FuSIpTg2pMg=; b=Em5CzWIM8Vb9C/BybHCkqq2VlVeZlDmkf/DSwUDx9Of+2U8KOSDDk6ogqWCpqBppSW Ln1C/2P3LZq06HSjAv/b3Kl2rmVl+gDVDgGaOTtlyQI2rev+VjTJOr0FNeh32fxr0Elo UoDQcj/BRr1qnUAqu1HTpkHEby1XiPtqfiMcWCL5JPPwo3cM4YZ834PZQU6ycr3s+8ht qNdcMj8xQLOzM0+8RnU6h7g2rXPktDZymseh1D2Fj1xDJk+pc4gmO8qhno179s+qVXB0 c+CAo5vCg/Q+BfUW1m7GQ4q6zoWo9eC0ZrOJy1RJMoDd5xkbBMPspJxyHJ/bv4apSnQL 199A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hCosJQXQwV9fVXF2HO5osVu0+IYThhw1FuSIpTg2pMg=; b=NnEUJbeb62aFa+NCYbfm/OTcuUXATD6nF8JPQ1MnkXJIqBhIps+RPp02ReC9y0YkGh lviCwXof73gvu8HKZJZYCgeN2Y4TjHqqW+gWNMAxjMklnAWYHXQPGfOoTPLVt3gqJSk/ T5nsGA/1HBveerdgX1D/5rW01/Wjv6L1NcCp+JJChf9OI8G2ODxd9yc25OMWVktw2CNC +9cMO2guEZX8+7SyjQRtZRdJHiEfa7LV4k18ITueXfHqhAAKOMY4NJwqdOJrxjW/aGtV jEvMmQFF71e7PdGGXqkGIZ2vtxC3OWszovYZ6ohPb5Olw8E+EveSUrp+XeBjx3jk3E9p h/IQ== X-Gm-Message-State: AOAM532aOt5rT3bfgdJecykkqPbu0VaeGL5s3kmdbfLnLvEPjpxb/N0+ cfO8gdnoO4qtbM92OvLRouHkKZzXBPJRWAFtn0hww0MEzYWM8w== X-Google-Smtp-Source: ABdhPJydP8CadXsLJzG5Vnn/f2sr1ngDzRpTZ5z+7fItMZi+cQcCYq6zeuwE6rbEH87dpciT8PMhHfsbgXdTPxHzCAs= X-Received: by 2002:a05:6808:bd1:: with SMTP id o17mr3681250oik.92.1632835641978; Tue, 28 Sep 2021 06:27:21 -0700 (PDT) MIME-Version: 1.0 References: <20210927112205.301876-1-vladimir.oltean@nxp.com> <20210927112205.301876-25-vladimir.oltean@nxp.com> In-Reply-To: <20210927112205.301876-25-vladimir.oltean@nxp.com> From: Ramon Fried Date: Tue, 28 Sep 2021 16:27:10 +0300 Message-ID: Subject: Re: [PATCH 24/25] arch: powerpc: mpc85xx: free MDIO bus if mdio_register fails To: Vladimir Oltean Cc: U-Boot Mailing List , Joe Hershberger Content-Type: text/plain; charset="UTF-8" X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Mon, Sep 27, 2021 at 2:22 PM Vladimir Oltean wrote: > > If mdio_register fails, it is nice to not leave behind dangling > allocated memory. > > Signed-off-by: Vladimir Oltean > --- > arch/powerpc/cpu/mpc85xx/ether_fcc.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/powerpc/cpu/mpc85xx/ether_fcc.c b/arch/powerpc/cpu/mpc85xx/ether_fcc.c > index 1f6f55707321..5cf0a3fb227a 100644 > --- a/arch/powerpc/cpu/mpc85xx/ether_fcc.c > +++ b/arch/powerpc/cpu/mpc85xx/ether_fcc.c > @@ -449,8 +449,10 @@ int fec_initialize(struct bd_info *bis) > mdiodev->write = bb_miiphy_write; > > retval = mdio_register(mdiodev); > - if (retval < 0) > + if (retval < 0) { > + mdio_free(mdiodev); > return retval; > + } > #endif > } > > -- > 2.25.1 > Reviewed-by: Ramon Fried