[PATCH v3 04/22] firmware: arm_scmi: add basic driver infrastructure for SCMI

Arnd Bergmann arnd at arndb.de
Wed Oct 4 04:19:40 PDT 2017


On Thu, Sep 28, 2017 at 3:11 PM, Sudeep Holla <sudeep.holla at arm.com> wrote:

> +static int scmi_mbox_free_channel(struct scmi_info *info)
> +{
> +       if (!IS_ERR_OR_NULL(info->tx_chan)) {
> +               mbox_free_channel(info->tx_chan);
> +               info->tx_chan = NULL;
> +       }
> +
> +       return 0;
> +}

Any use of IS_ERR_OR_NULL() tends to be an indication of a bad API
design. Please make a decision about what you want to store in
info->tx_chan and stick with it.

Usually, we don't store error pointers in permanent data structures.
If you can deal with tx_chan being absent here, then you can just
store NULL into it when you don't have one, otherwise you should
make sure you never call this and fail the probe function earlier.

      Arnd



More information about the linux-arm-kernel mailing list