All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Claudiu Manoil <claudiu.manoil@nxp.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	devicetree@vger.kernel.org, netdev@vger.kernel.org,
	alexandru.marginean@nxp.com, linux-kernel@vger.kernel.org,
	Li Yang <leoyang.li@nxp.com>, Rob Herring <robh+dt@kernel.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] enetc: Add mdio bus driver for the PCIe MDIO endpoint
Date: Wed, 24 Jul 2019 00:24:54 +0200	[thread overview]
Message-ID: <20190723222454.GE13517@lunn.ch> (raw)
In-Reply-To: <1563894955-545-2-git-send-email-claudiu.manoil@nxp.com>

> +	bus = mdiobus_alloc_size(sizeof(u32 *));
> +	if (!bus)
> +		return -ENOMEM;
> +

> +	bus->priv = pci_iomap_range(pdev, 0, ENETC_MDIO_REG_OFFSET, 0);

This got me confused for a while. You allocate space for a u32
pointer. bus->priv will point to this space. However, you are not
using this space, you {ab}use the pointer to directly hold the return
from pci_iomap_range(). This works, but sparse is probably unhappy,
and you are wasting the space the u32 pointer takes.

    Andrew

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Lunn <andrew@lunn.ch>
To: Claudiu Manoil <claudiu.manoil@nxp.com>
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
	alexandru.marginean@nxp.com, linux-kernel@vger.kernel.org,
	Li Yang <leoyang.li@nxp.com>, Rob Herring <robh+dt@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH net-next 1/3] enetc: Add mdio bus driver for the PCIe MDIO endpoint
Date: Wed, 24 Jul 2019 00:24:54 +0200	[thread overview]
Message-ID: <20190723222454.GE13517@lunn.ch> (raw)
In-Reply-To: <1563894955-545-2-git-send-email-claudiu.manoil@nxp.com>

> +	bus = mdiobus_alloc_size(sizeof(u32 *));
> +	if (!bus)
> +		return -ENOMEM;
> +

> +	bus->priv = pci_iomap_range(pdev, 0, ENETC_MDIO_REG_OFFSET, 0);

This got me confused for a while. You allocate space for a u32
pointer. bus->priv will point to this space. However, you are not
using this space, you {ab}use the pointer to directly hold the return
from pci_iomap_range(). This works, but sparse is probably unhappy,
and you are wasting the space the u32 pointer takes.

    Andrew

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-07-23 22:25 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23 15:15 [PATCH net-next 0/3] enetc: Add mdio bus driver for the PCIe MDIO endpoint Claudiu Manoil
2019-07-23 15:15 ` Claudiu Manoil
2019-07-23 15:15 ` [PATCH net-next 1/3] " Claudiu Manoil
2019-07-23 15:15   ` Claudiu Manoil
2019-07-23 20:49   ` Saeed Mahameed
2019-07-23 20:49     ` Saeed Mahameed
2019-07-23 20:49     ` Saeed Mahameed
2019-07-24  9:55     ` Claudiu Manoil
2019-07-24  9:55       ` Claudiu Manoil
2019-07-24  9:55       ` Claudiu Manoil
2019-07-23 22:24   ` Andrew Lunn [this message]
2019-07-23 22:24     ` Andrew Lunn
2019-07-24  9:53     ` Claudiu Manoil
2019-07-24  9:53       ` Claudiu Manoil
2019-07-24  9:53       ` Claudiu Manoil
2019-07-24 12:57       ` Claudiu Manoil
2019-07-24 12:57         ` Claudiu Manoil
2019-07-24 12:57         ` Claudiu Manoil
2019-07-23 15:15 ` [PATCH net-next 2/3] dt-bindings: net: fsl: enetc: Add bindings for the central MDIO PCIe endpoint Claudiu Manoil
2019-07-23 15:15   ` Claudiu Manoil
2019-07-23 15:15 ` [PATCH net-next 3/3] arm64: dts: ls1028a: Enable eth port1 on the ls1028a QDS board Claudiu Manoil
2019-07-23 15:15   ` Claudiu Manoil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190723222454.GE13517@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=alexandru.marginean@nxp.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.