linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@st.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexandre TORGUE <alexandre.torgue@st.com>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Andrea Merello <andrea.merello@gmail.com>
Subject: Re: [PATCH v2 04/15] mmc: mmci: Add support for setting pad type via pinctrl
Date: Thu, 18 Jan 2018 13:35:05 +0000	[thread overview]
Message-ID: <0c73774b-f06e-2db8-ef50-3bf590b57cff@st.com> (raw)
In-Reply-To: <CAPDyKFoVT7rqLVzYVrO8JTD_MVLxr_R8PO=fWqLVG4DB1MpnTQ@mail.gmail.com>

Hi Ulf

On 01/17/2018 10:34 AM, Ulf Hansson wrote:
> [...]
> 
>>          /*
>> @@ -1616,6 +1625,32 @@ static int mmci_probe(struct amba_device *dev,
>>          host = mmc_priv(mmc);
>>          host->mmc = mmc;
>>
>> +       /*
>> +        * Some variant (STM32) doesn't have opendrain bit, nevertheless
>> +        * pins can be set accordingly using pinctrl
>> +        */
>> +       if (!variant->opendrain) {
>> +               host->pinctrl = devm_pinctrl_get(&dev->dev);
>> +               if (IS_ERR(host->pinctrl)) {
>> +                       dev_err(&dev->dev, "failed to get pinctrl");
>> +                       goto host_free;
>> +               }
>> +
>> +               host->pins_default = pinctrl_lookup_state(host->pinctrl,
>> +                                                         PINCTRL_STATE_DEFAULT);
>> +               if (IS_ERR(host->pins_default)) {
>> +                       dev_warn(mmc_dev(mmc), "Can't select default pins\n");
>> +                       host->pins_default = NULL;
> 
> This is wrong, I think you should bail out and return the error code instead.

Ok

> 
> Moreover, calling pinctrl_select_state() from ->set_ios by using a
> NULL state, will likely trigger a NULL pointer deference bug in the
> pinctrl layer.

Regarding pinctrl_select_state() call with a NULL state, this case is 
managed inside pinctrl_state(), but ok, it will be more elegant to exit 
directly in case of no DT pins definition found.

> 
>> +               }
>> +
>> +               host->pins_opendrain = pinctrl_lookup_state(host->pinctrl,
>> +                                                           MMCI_PINCTRL_STATE_OPENDRAIN);
>> +               if (IS_ERR(host->pins_opendrain)) {
>> +                       dev_warn(mmc_dev(mmc), "Can't select opendrain pins\n");
>> +                       host->pins_opendrain = NULL;
> 
> Ditto.

ok

Thanks

Patrice
> 
>> +               }
>> +       }
>> +
> 
> [...]
> 
> Kind regards
> Uffe
> 

  reply	other threads:[~2018-01-18 13:35 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 12:30 [PATCH v2 00/15] Add MMCI support for STM32F SoCs family patrice.chotard
2018-01-16 12:30 ` [PATCH v2 01/15] mmc: mmci: Don't pretend all variants to have MMCIMASK1 register patrice.chotard
2018-01-16 12:30 ` [PATCH v2 02/15] mmc: mmci: Don't pretend all variants to have MCI_STARBITERR flag patrice.chotard
2018-01-16 12:30 ` [PATCH v2 03/15] mmc: mmci: Don't pretend all variants to have OPENDRAIN bit patrice.chotard
2018-01-17  9:33   ` Ulf Hansson
2018-01-18 13:24     ` Patrice CHOTARD
2018-01-16 12:30 ` [PATCH v2 04/15] mmc: mmci: Add support for setting pad type via pinctrl patrice.chotard
2018-01-17  9:34   ` Ulf Hansson
2018-01-18 13:35     ` Patrice CHOTARD [this message]
2018-01-16 12:30 ` [PATCH v2 05/15] mmc: mmci: Add STM32 variant patrice.chotard
2018-01-16 12:30 ` [PATCH v2 06/15] ARM: dts: stm32: Add SDIO controller for stm32f746 patrice.chotard
2018-01-16 12:30 ` [PATCH v2 07/15] ARM: dts: stm32: Add SDIO controller for stm32f429 patrice.chotard
2018-01-16 12:30 ` [PATCH v2 08/15] ARM: dts: stm32: Add pin map for SDIO controller on stm32f4 patrice.chotard
2018-01-16 12:30 ` [PATCH v2 09/15] ARM: dts: stm32: Enable SDIO controller on stm32f469 disco board patrice.chotard
2018-01-16 12:30 ` [PATCH v2 10/15] ARM: dts: stm32: Enable SDIO controller on stm32429i-eval board patrice.chotard
2018-01-16 12:30 ` [PATCH v2 11/15] ARM: stm32: Add AMBA support for STM32F4 and STM32F7 SoCs patrice.chotard
2018-01-16 12:30 ` [PATCH v2 12/15] ARM: configs: stm32: Enable MMC_ARMMMCI support patrice.chotard
2018-01-16 12:30 ` [PATCH v2 13/15] ARM: configs: stm32: Enable EXT3_FS support patrice.chotard
2018-01-16 12:30 ` [PATCH v2 14/15] clk: stm32: Add clk entry for SDMMC2 on stm32F769 patrice.chotard
2018-02-26  8:41   ` Patrice CHOTARD
2018-03-01  9:12     ` Linus Walleij
2018-03-01  9:42       ` Patrice CHOTARD
2018-03-15 21:24       ` Stephen Boyd
2018-01-16 12:30 ` [PATCH v2 15/15] gpio: stmpe: i2c transfer are forbiden in atomic context patrice.chotard

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=0c73774b-f06e-2db8-ef50-3bf590b57cff@st.com \
    --to=patrice.chotard@st.com \
    --cc=alexandre.torgue@st.com \
    --cc=andrea.merello@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=ulf.hansson@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).