Message ID | 20221110094445.2930509-4-cuigaosheng1@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix IS_ERR() vs NULL check for drm | expand |
On 2022-11-10 17:44:43, Gaosheng Cui wrote: > The of_icc_get() function returns NULL or error pointers on error path, > so we should use IS_ERR_OR_NULL() to check the return value. > > Fixes: 5ccdcecaf8f7 ("drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices") > Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> > --- > drivers/gpu/drm/msm/msm_io_utils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c > index d02cd29ce829..950083b2f092 100644 > --- a/drivers/gpu/drm/msm/msm_io_utils.c > +++ b/drivers/gpu/drm/msm/msm_io_utils.c > @@ -133,7 +133,7 @@ struct icc_path *msm_icc_get(struct device *dev, const char *name) > struct icc_path *path; > > path = of_icc_get(dev, name); > - if (path) > + if (IS_ERR_OR_NULL(path)) NAK. This path should be returned if it is NON-NULL, otherwise we defer to of_icc_get() on the parent device. See the code-comment below. - Marijn > return path; > > /* > -- > 2.25.1 >
> NAK. This path should be returned if it is NON-NULL, otherwise we defer > to of_icc_get() on the parent device. See the code-comment below. Thanks for taking time to review this patch, how do you think of the following changes: > diff --git a/drivers/gpu/drm/msm/msm_io_utils.c > b/drivers/gpu/drm/msm/msm_io_utils.c index d02cd29ce829..a112d8c74d59 > 100644 --- a/drivers/gpu/drm/msm/msm_io_utils.c +++ > b/drivers/gpu/drm/msm/msm_io_utils.c @@ -133,7 +133,7 @@ struct > icc_path *msm_icc_get(struct device *dev, const char *name) struct > icc_path *path; path = of_icc_get(dev, name); - if (path) + if > (!IS_ERR_OR_NULL(path)) return path; Looking forward to your reply, thanks again! On 2022/11/11 18:02, Marijn Suijten wrote: > On 2022-11-10 17:44:43, Gaosheng Cui wrote: >> The of_icc_get() function returns NULL or error pointers on error path, >> so we should use IS_ERR_OR_NULL() to check the return value. >> >> Fixes: 5ccdcecaf8f7 ("drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices") >> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> >> --- >> drivers/gpu/drm/msm/msm_io_utils.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c >> index d02cd29ce829..950083b2f092 100644 >> --- a/drivers/gpu/drm/msm/msm_io_utils.c >> +++ b/drivers/gpu/drm/msm/msm_io_utils.c >> @@ -133,7 +133,7 @@ struct icc_path *msm_icc_get(struct device *dev, const char *name) >> struct icc_path *path; >> >> path = of_icc_get(dev, name); >> - if (path) >> + if (IS_ERR_OR_NULL(path)) > NAK. This path should be returned if it is NON-NULL, otherwise we defer > to of_icc_get() on the parent device. See the code-comment below. > > - Marijn > >> return path; >> >> /* >> -- >> 2.25.1 >> > .
diff --git a/drivers/gpu/drm/msm/msm_io_utils.c b/drivers/gpu/drm/msm/msm_io_utils.c index d02cd29ce829..950083b2f092 100644 --- a/drivers/gpu/drm/msm/msm_io_utils.c +++ b/drivers/gpu/drm/msm/msm_io_utils.c @@ -133,7 +133,7 @@ struct icc_path *msm_icc_get(struct device *dev, const char *name) struct icc_path *path; path = of_icc_get(dev, name); - if (path) + if (IS_ERR_OR_NULL(path)) return path; /*
The of_icc_get() function returns NULL or error pointers on error path, so we should use IS_ERR_OR_NULL() to check the return value. Fixes: 5ccdcecaf8f7 ("drm/msm: lookup the ICC paths in both mdp5/dpu and mdss devices") Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> --- drivers/gpu/drm/msm/msm_io_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)