lkml.org 
[lkml]   [2017]   [Oct]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v3 04/22] firmware: arm_scmi: add basic driver infrastructure for SCMI
On Thu, Sep 28, 2017 at 3:11 PM, Sudeep Holla <sudeep.holla@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

\
 
 \ /
  Last update: 2017-10-04 13:20    [W:0.443 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site