drivers/mux/mux-core.c:491:9-16: WARNING: ERR_CAST can be used with mux_chip


 Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))

Generated by: scripts/coccinelle/api/err_cast.cocci

Fixes: 1203d8a531ed ("mux: Add new API to get mux_control ref by device name.")
CC: Kuppuswamy Sathyanarayanan <[email protected]>
Signed-off-by: Fengguang Wu <[email protected]>
---

 mux-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/mux/mux-core.c
+++ b/drivers/mux/mux-core.c
@@ -488,7 +488,7 @@ struct mux_control *mux_control_get_by_i
        mux_chip = mux_chip_get_by_index(devname, chip_index);
 
        if (IS_ERR(mux_chip))
-               return ERR_PTR(PTR_ERR(mux_chip));
+               return ERR_CAST(mux_chip);
 
        if (ctrl_index >= mux_chip->controllers) {
                dev_err(&mux_chip->dev,

Reply via email to